internal AclEditor SetPermission(int principalId, bool propagates, PermissionType permissionType, PermissionValue permissionValue) { var entry = GetEntry(principalId, propagates); var perm = GetSnPerm(entry, permissionType); uint allowBits; uint denyBits; entry.GetPermissionBits(out allowBits, out denyBits); PermissionBits.SetBits(ref allowBits, ref denyBits, permissionType, permissionValue); entry.SetPermissionsBits(allowBits, denyBits); return(this); }
internal void AddEntry(SnAccessControlEntry entry) { var newEntry = CreateEntry(entry.Identity.NodeId, entry.Propagates); uint allowBits, denyBits; entry.GetPermissionBits(out allowBits, out denyBits); PermissionBits.SetBits(ref allowBits, ref denyBits); newEntry.SetPermissionsBits(allowBits, denyBits); var list = acl.Entries.ToList(); list.Add(newEntry); acl.Entries = list.ToArray(); }
private bool HasBits(PermissionBits permBits, PermissionLevel level, uint permissionMask) { switch (level) { case PermissionLevel.Allowed: return((permBits.AllowBits & permissionMask) != 0); case PermissionLevel.Denied: return((permBits.DenyBits & permissionMask) != 0); case PermissionLevel.AllowedOrDenied: return(((permBits.AllowBits | permBits.DenyBits) & permissionMask) != 0); default: throw new NotImplementedException("Unknown PermissionLevel: " + level); } }