public IChannelACLEntry CreateACLEntry(IChannelGroup targetGroup) { var x = new ChanACL { ApplyOnSubchannels = true, ApplyOnThisChannel = true, Allow = (ChannelPermissions)0, Deny = (ChannelPermissions)0, TargetGroup = targetGroup, }; ACL.Add(x); return(x); }
public async Task Refresh() { var aclData = await Server.GetACL(ChannelId); Inherit = aclData.Inherit; var aclGroups = aclData.Groups.Select(x => new ChanGroup { _Inherited = x.inherited, IncludeMembersFromParentChannels = x.inherit, Inheritable = x.inheritable, Name = x.name, Members = new HashSet <int>(x.add), NegativeMembers = new HashSet <int>(x.remove), }).ToArray(); var aclProxies = aclData.ACLs.Select(x => { var acl = new ChanACL { _Inherited = x.inherited, ApplyOnSubchannels = x.applySubs, ApplyOnThisChannel = x.applyHere, Allow = (ChannelPermissions)x.allow, Deny = (ChannelPermissions)x.deny, }; if (x.userid == -1) { acl.TargetGroup = aclGroups.Where(y => y.Name == x.group).SingleOrDefault() ?? TryLookupSystemGroup(x); } else { acl.TargetUser = x.userid; } return(acl); }); InheritedACL = aclProxies.Where(x => x._Inherited).ToList <IChannelACLEntryReadonly>(); ACL = aclProxies.Where(x => !x._Inherited).ToList <IChannelACLEntry>(); InheritedGroups = aclGroups.Where(x => x._Inherited).ToList <IChannelUserGroupInherited>(); Groups = aclGroups.Where(x => !x._Inherited).ToList <IChannelUserGroup>(); }