public void RemoveMember(string aclObjectId, IAclMember member) { DB.Update <T>() .Match(a => a.ID == aclObjectId) .Modify(a => a.Unset(string.Format("acl.{0}.{1}", MemberList.readers.ToString("g"), member.Id))) .Modify(a => a.Unset(string.Format("acl.{0}.{1}", MemberList.admins.ToString("g"), member.Id))) .Execute(); }
public bool AddMember(string aclObjectId, IAclMember member, MemberList type) { MemberList otherType = type == MemberList.admins ? MemberList.readers : MemberList.admins; MemberType memberType = (member as User) != null ? MemberType.user : MemberType.team; // TODO: Check to see if member is an owner, if so, don't do anything DB.Update <T>() .Match(t => t.Eq(a => a.ID, aclObjectId) & t.Ne(a => a.acl.ownerId, member.Id)) .Modify(a => a.Set(ACLMemberString(member.Id, type), memberType)) .Modify(a => a.Unset(ACLMemberString(member.Id, otherType))) .Execute(); return(true); }
public void RemoveMember(string id, string unMemberId, User subject) { if (!membershipInterface.IsAdmin(id, subject)) { throw new NotAuthorized(); } IAclMember unMember = userInterface.GetById(unMemberId); if (unMember == null) { unMember = teamInterface.GetById(unMemberId); } if (unMember == null) { return; } membershipInterface.RemoveMember(id, unMember); }
public bool AddReader(string id, string newAdminId, User subject) { if (!membershipInterface.IsAdmin(id, subject)) { throw new NotAuthorized(); } IAclMember newAdmin = userInterface.GetById(newAdminId); if (newAdmin == null) { newAdmin = teamInterface.GetById(newAdminId); } if (newAdmin == null) { return(false); } return(membershipInterface.AddMember(id, newAdmin, MemberList.readers)); }