This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

DEVELOPERS FORUM - Check Identity List for specific identity

handpuppet - Monday, July 20, 2015 2:53 PM:

I have the following code that I have that attempts to get the list of all Identites, and then search through all of the indentities for two specific groups that I would like to deny access to, but it never finds the identity names I have that it checks for.  Anyone have any idea on how to fix this?

 

string[] identityList = Aras.Server.Security.Permissions.Current.IdentitiesList.Split(new []{","}, StringSplitOptions.RemoveEmptyEntries);

var identityHash = new HashSet<string>(identityList.Select(id => id.Trim(new []{'''})));

bool accessdenied = false;

for (int x = 0; x < identityList.Length; x++)
{
 if (identityList[x].Equals("Group1Users"))
 {
  accessdenied = true;
 }
 else if (identityList[x].Equals("Group2Users"))
 {
  accessdenied = true;
 }
}



zahar - Monday, July 20, 2015 3:03 PM:

IdentitiesList returns list of IDs and not names

What you need to do is to get your required Identites ID and then check if they exists in the list

string[] identityList = Aras.Server.Security.Permissions.Current.IdentitiesList.Split(new []{","}, StringSplitOptions.RemoveEmptyEntries);

Item Group1Users = this.getInnovator().getItemByKeyedName("Identity", "Group1Users");

Item Group2Users = this.getInnovator().getItemByKeyedName("Identity", "Group1Users");

accessdenied  = (identityList.indexOf(Group1Users.getID()) > -1 || identityList.indexOf(Group2Users.getID()) > -1);



handpuppet - Tuesday, July 21, 2015 8:23 AM:

Thank you for the suggestion.  The Group 1 users and Group 2 users do not seem to be recognizing that they are in those Items where the code checks.  I am debugging