private bool GetAccess(AVACL.AccessKind kind, string userId) { if (userId == null) { throw new ArgumentException("Cannot get access for an unsaved user or role."); } switch (kind) { case AVACL.AccessKind.Read: { return this.readers.Contains(userId); } case AVACL.AccessKind.Write: { return this.writers.Contains(userId); } } throw new NotImplementedException("Unknown AccessKind"); }
public AVRole(string name, AVACL acl) : this() { this.Name = name; base.ACL = acl; }
private void SetAccess(AVACL.AccessKind kind, string userId, bool allowed) { if (userId == null) { throw new ArgumentException("Cannot set access for an unsaved user or role."); } ICollection<string> collection = null; switch (kind) { case AVACL.AccessKind.Read: { collection = this.readers; break; } case AVACL.AccessKind.Write: { collection = this.writers; break; } default: { throw new NotImplementedException("Unknown AccessKind"); } } if (allowed) { collection.Add(userId); return; } collection.Remove(userId); }