Anonymous_User Absent Member.
Absent Member.
239 views

Condition activity expression - group membership check


Hi

I have a PRD where I want to check if the initiator is a member of a
certain group.
Based on this condition being "true", the workflow should take a certain
path.
Will the following code work in the condition expression? If not,
what's the best way to sort this one out?
------------
(CheckHRmembership(initiator) == "x" ) ? true:false;

function CheckHRmembership(userDN)
{
var grp = IDVault.get(userDN,'user','group');
var isMember;
var grpIterator = grp.iterator();

while(grpIterator.hasNext()){
var currentNode = grpIterator.next();
if (currentNode == "CN=XXX_IDM_HR,OU=groups,O=data")
{isMember="x";
break ;}
else
continue;
}
return isMember;
}


--
rohit_everett
------------------------------------------------------------------------
rohit_everett's Profile: https://forums.netiq.com/member.php?userid=4650
View this thread: https://forums.netiq.com/showthread.php?t=48837

Labels (1)
0 Likes
2 Replies
Anonymous_User Absent Member.
Absent Member.

Re: Condition activity expression - group membership check


Hi,
the compare expression is wrong. Try something like this:

if ( currentNode.toLowerCase().equals(strGroup.toLowerCase()) ) {
isMember = true;
}

Best regards,

Alessandro


rohit_everett;234841 Wrote:
> Hi
>
> I have a PRD where I want to check if the initiator is a member of a
> certain group.
> Based on this condition being "true", the workflow should take a certain
> path.
> Will the following code work in the condition expression? The problem I
> have right now is that the function seems to be getting called but the
> condition always evaluated to False. The logs do not show any error so
> hard to troubleshoot. If not, what's the best way to sort this one
> out?
> ------------
> (CheckHRmembership(initiator) == "x" ) ? true:false;
>
> function CheckHRmembership(userDN)
> {
> var grp = IDVault.get(userDN,'user','group');
> var isMember;
> var grpIterator = grp.iterator();
>
> while(grpIterator.hasNext()){
> var currentNode = grpIterator.next();
> if (currentNode == "CN=XXX_IDM_HR,OU=groups,O=data")
> {isMember="x";
> break ;}
> else
> continue;
> }
> return isMember;
> }



--
afolli
------------------------------------------------------------------------
afolli's Profile: https://forums.netiq.com/member.php?userid=172
View this thread: https://forums.netiq.com/showthread.php?t=48837

0 Likes
Anonymous_User Absent Member.
Absent Member.

Re: Condition activity expression - group membership check


Hi

Thanks. That worked. So my code now looks like this and it works:

(CheckHRmembership(initiator) == "x" ) ? true:false;

function CheckHRmembership(userDN)
{
var grp = IDVault.get(userDN,'user','group');
var hr_grp = "CN=xxx_IDM_HR,OU=groups,O=data";
var isMember;
var grpIterator = grp.iterator();

while(grpIterator.hasNext()){
var currentNode = grpIterator.next();
if (currentNode.toLowerCase() == hr_grp.toLowerCase())
{isMember="x";
break ;}
else
continue;
}
return isMember;
}


--
rohit_everett
------------------------------------------------------------------------
rohit_everett's Profile: https://forums.netiq.com/member.php?userid=4650
View this thread: https://forums.netiq.com/showthread.php?t=48837

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.