Exemple #1
0
        private IEnumerable <int> FlattenDynamicGroups(IEnumerable <int> extension)
        {
            var flattened = new List <int>();

            foreach (var groupId in extension)
            {
                if (!flattened.Contains(groupId))
                {
                    flattened.Add(groupId);
                }
                foreach (var id in PermissionQuery.GetParentGroups(_securityContext, groupId, false))
                {
                    if (!flattened.Contains(id))
                    {
                        flattened.Add(id);
                    }
                }
            }
            return(flattened);
        }
Exemple #2
0
 /// <summary>
 /// Returns Ids of all groups where the given user or group is member directly or indirectly.
 /// </summary>
 /// <param name="identityId">Id of the group or user.</param>
 /// <param name="directOnly">Switch of the direct or indirect membership.</param>
 protected IEnumerable <int> GetParentGroups(int identityId, bool directOnly)
 {
     return(PermissionQuery.GetParentGroups(this, identityId, directOnly));
 }
 /// <summary>
 /// Returns Ids of all groups where the given user or group is member directly or indirectly.
 /// </summary>
 /// <param name="identityId">Id of the group or user.</param>
 /// <param name="directOnly">Switch of the direct or indirect membership.</param>
 public virtual IEnumerable <int> GetParentGroups(int identityId, bool directOnly)
 {
     return(_permissionQuery.GetParentGroups(this, identityId, directOnly));
 }