I want to fetch access rights of a user to an item who has been under a security role. I am controlling the access to that particular item by adding the user to that role. Can someone help how I can fetch the access rights of those users under a role programatically?
1 Answer
It should be like this:
AccessRuleCollection accessRules = item.Security.GetAccessRules();
AccessRightCollection accessRights = AccessRightManager.GetAccessRights();
foreach (AccessRight accessRight in accessRights)
{
AccessPermission accessPermission =
accessRules.Helper.GetAccessPermission(account, accessRight, PropagationType.Entity);
// use accessPermission value here as you wish
}
Don't forget to set account
before and fill it with user you are interested in.