internal bool IsInGroup(int memberId, int groupId) { // if it is a user: first look for the id in the flattened user --> groups collection if (Membership.TryGetValue(memberId, out var flattenedGroups)) { return(flattenedGroups.Contains(groupId)); } // if it is a group: search in the group graph if (Groups.TryGetValue(memberId, out var group)) { return(Flattener.GetAllParentGroupIdsExclusive(group).Contains(groupId)); } return(false); }
internal IEnumerable <int> GetAllParentGroupIds(SecurityGroup group) { return(Flattener.GetAllParentGroupIdsExclusive(group)); }