internal AccessDefinition CalculateAccess(IEnumerable<Xid> groupIds) { if (null == groupIds) { throw new ArgumentNullException("groupIds"); } AccessDefinition type; var output = new AccessDefinition(); // Load group list var groupIdsFull = new List<Xid>() { Ids.Everyone }; groupIdsFull.AddRange(groupIds); // Work out specifically what this user has access to foreach (var groupId in groupIdsFull) { if (!GroupAccess.TryGetValue(groupId, out type)) { continue; // Skip undefined group } // Add permissions to output output.SettableProperties.AddMany(type.SettableProperties); output.GettableProperties.AddMany(type.GettableProperties); output.SettableLinks.AddMany(type.SettableLinks); output.GettableLinks.AddMany(type.GettableLinks); if (type.CanDelete) { output.CanDelete = true; } } return output; }
internal AccessDefinition CalculateSystemAccess() { var output = new AccessDefinition(); output.GettableProperties.AddMany(new HashSet<int>(Properties.Keys)); output.SettableProperties.AddMany(new HashSet<int>(Properties.Keys)); output.GettableLinks.AddMany(new HashSet<int>(Links.Keys)); output.SettableLinks.AddMany(new HashSet<int>(Links.Keys)); output.CanDelete = true; return output; }
public AccessDefinition GetGroupAccess(Xid groupId) { AccessDefinition access; if (!GroupAccess.TryGetValue(groupId, out access)) { access = GroupAccess[groupId] = new AccessDefinition(); } return access; }