rejetto forum

notes key in member of

Roessi · 3 · 3802

0 Members and 1 Guest are viewing this topic.

Offline Roessi

  • Tireless poster
  • ****
    • Posts: 107
    • View Profile
hey im kinda new to hfs and wanted to ask if theres an integrated possible to check if a notes key exist in any group the current logged in user is a member of.
i tried to write sth. to check this but it doesnt work. and as i dont really know how to write scripts in hfs i wanted to ask if anyone has an idea whats wrong in the code ;)

Code: [Select]

{.set|#i|{.count substring|;|{.member of|.}.}.}
{.^#i.}
{.set|groups|;{.member of|.};.}
{.set|curgroup|{.substring|;|;|{.^groups.}|include=0 .}.}
{.set|hasrigth|false.}
{.^curgroup.}
{.while|#i|0.}|
as
{.^curgroup.}
{.if|{.get account|{.^curgroup.}|notes key=test.}|{:
{.set|hasrigth|true.}
hasrigth:{.^hasrigth.}
{.set|#i|.}

.}
{.if not|{.get account|{.^curgroup.}|notes key=test.}|{:
{.set|hasrigth|false.}
{.set|groups|{.cut|{.length|curgroup.}|{.calc|{.length|groups.}-({.length|curgroup.}-2).}|{.^groups.}.}.}
{.set|curgroup|{.substring|;|;|{.^groups.}|include=0 .}.}

hasrigth:{.^hasrigth.}

.}
{.dec|#i.}


.}

hasrigth:{.^hasrigth.}



Offline bacter

  • Operator
  • Tireless poster
  • *****
    • Posts: 681
    • View Profile
Hi Roessi

You did things not the right way and telling you where are the errors, would be longer than propose a piece of code.


Code: [Select]
{.set|#accgroups|{.get|accounts|groups.}.}
{.set|#ng|{.count substring|*|{.^#accgroups.}.}.}       {.comment| works if groupname stars with * .}
{.for|ii|1|{.^#ng.}|
{:
{.set|tg2|{.substring||;|{.^tg.}.}.}{.set|tg|{.replace|{.^tg2.};||{.^tg.}.}.}
{.if|{.member of|{.^tg2.}|user=%user%.}|
{:
{.set|testval|{.get account|{.^tg2.}|notes key=test.}.}
{.if|{.=|{.^testval.}|allowedvalue.}| {:     set or do something      :}.}
:}
:}.}

I hope you can understand this code and complete or modify it for your needs.

your computer has no brain - use your own !


Offline Roessi

  • Tireless poster
  • ****
    • Posts: 107
    • View Profile
perfect thx very much understood and were able to make a function out of it :) now its working :)
Code: [Select]
[special:begin]
{.set|getgroupkey|{:
{.set|#accgroups|{.member of|.};%user%.}
{.set|#ng|{.count substring|;|{.^#accgroups.}.}.}       
{.dec|#ng.}
{.set|tg|{.^#accgroups.};.}

{.for|ii|-1|{.^#ng.}|
{:
{.set|tg2|{.substring||;|{.^tg.}.}.}
{.set|tg|{.replace|{.^tg2.};||{.^tg.}.}.}
{.if|{.get account|{.^tg2.}|notes key=$1.}}|
{.set|groupkey|{.get account|{.^tg2.}|notes key=$1.}.}
{.^groupkey.}

.}


:}.}
:}.}

{.set|ggk|{:
{.if|
{.and| {.=|{.count substring|false|{.^getgroupkey|$1.}.}|0.} | {.>|{.count substring|true|{.^getgroupkey|$1.}.}|0.} .}|true
|
{.if|{.=|{.get account|%user%|notes key=$1.}|true.}|true.}
.}
:}
.}
finally im able to realize group policies :) thx ;)
« Last Edit: December 19, 2009, 12:23:24 AM by Roessi »