Hello everyone,
This is a follow-up post to one I made here:
User Security Properties Report Data Location - Laserfiche Answers
I've almost got my script to work; however, instead of pulling all groups a user is associated with, it is only showing the first one. Here is my script:
protected override void Execute()
{
// Write your code here. The BoundEntryInfo property will access the entry, RASession will get the Repository Access session
try
{
SecurityIdentifier EVERYONE_SID = new SecurityIdentifier("S-1-1-0");
var trusteeList = Trustee.EnumAllWindowsAccounts(this.RASession).Select(account => account.Sid);
foreach (var sid in trusteeList)
{
AccountReference acctRef = new AccountReference(sid, this.RASession);
string accountName = acctRef.AccountName;
if (acctRef.TrusteeType == TrusteeType.WindowsAccount && !acctRef.IsUser)
continue; // Don't retrieve groups for other groups
try
{
EffectiveAccessTokenInfo tokenInfo = Trustee.GetEffectiveAccessTokenInfo(sid, this.RASession);
foreach (var groupSid in tokenInfo.Groups)
{
if (groupSid == EVERYONE_SID)
continue;
AccountReference grp = new AccountReference(groupSid, this.RASession);
string[] groupNames = new string[] { grp.AccountName };
foreach (var groupName in groupNames)
{
SetTokenValue(accountName, groupName);
}
}
}
catch {}
}
}
catch {}
}
I need all groups a user is associated with to populate in the token value section of the watch tab in Workflow SDK script activity. Any insight is greatly appreciated.
Thanks!