public interface MembershipService
assigned
or defined
. Users who are added to
membership are considered assigned
at that context and can be removed at any time. Groups that are defined at
the context (meaning they were created at the context) are considered defined
at that context. Defined
members cannot be removed from membership, they must be deleted from the context that implicitly removes them
from membership. Groups defined at a context are available for assigment
at lower subcontexts with the membership
capability.Modifier and Type | Method and Description |
---|---|
void |
addMember(String contextId,
Principal member)
Adds the principal to the membership list of a membership context.
|
void |
addMembers(String contextId,
Set<Principal> members)
Adds the principals to the membership list of a membership context.
|
Set<Principal> |
getAssignedMembers(String contextId)
Retrieves the set of assigned members for the specified context.
|
Membership |
getMembership(String contextId)
Retrieves the membership information for the context.
|
Membership |
getMembershipByPath(String path)
Retrieves the membership information for the specified repository path.
|
Set<MembershipDescriptor> |
getMemberships(Principal member)
Gets the set of membership context identifiers in which the principal is a member.
|
Set<Principal> |
getPotentialMembers(String contextId,
boolean checkParentsIfRequired)
Retrieves the set of potential members that can be added as members to the context.
|
boolean |
isMember(String contextId,
Principal member,
boolean includeImplicit)
Indicates whether the principal is an explicit member of the membership context.
|
void |
removeMember(String contextId,
Principal member)
Removes the principal from the membership list of the specified context.
|
void |
removeMembers(String contextId,
Set<Principal> members)
Removes the principals from the membership list of the specified context.
|
Membership |
updateMembership(Membership membership)
Updates the assigned members of a context.
|
void addMember(String contextId, Principal member) throws MemberExistsException, InvalidMemberException
This method requires Read access to the context.
This method requires the ScopedPrivileges.PRIVILEGE_MANAGE_MEMBERSHIP
privilege.
contextId
- the membership context.member
- the principal to add to the membership context.MemberExistsException
- thrown when the principal is a member of the context.InvalidMemberException
- thrown when the principal cannot be a member of the specified context.void addMembers(String contextId, Set<Principal> members) throws MemberExistsException, InvalidMemberException
This method requires Read access to the context.
This method requires the ScopedPrivileges.PRIVILEGE_MANAGE_MEMBERSHIP
privilege.
contextId
- the membership context.members
- the principals to add to the membership context.MemberExistsException
- thrown when some of the principals are members of this context.InvalidMemberException
- thrown when some of the principals cannot be members of the context.void removeMember(String contextId, Principal member) throws MemberNotFoundException, InvalidMemberException
This method requires Read access to the context.
This method requires the ScopedPrivileges.PRIVILEGE_MANAGE_MEMBERSHIP
privilege.
contextId
- the membership context.member
- the principal to remove from the membership context.MemberNotFoundException
- thrown when the principal is not found in the membership list.InvalidMemberException
- thrown when the principal is not removed from the membership, such as
a group that is defined
at the context and is therefore implicitly a member.void removeMembers(String contextId, Set<Principal> members) throws MemberNotFoundException, InvalidMemberException
This method requires Read access to the context.
This method requires the ScopedPrivileges.PRIVILEGE_MANAGE_MEMBERSHIP
privilege.
contextId
- The membership context.members
- the principals to remove from the membership context.MemberNotFoundException
- thrown when some of the principals are not found in the membership list.InvalidMemberException
- thrown when some of the principals removed from the
membership, such as a group that is defined
at the context and is therefore implicitly a
member.boolean isMember(String contextId, Principal member, boolean includeImplicit)
If the context or principal is not found, or you do not have access to the context this method returns False
.
contextId
- the membership context.member
- the principal.includeImplicit
- True
when the membership check should include implicit memberships through groups,
False
, if this should be an explicit membership only.boolean
value that indicates whether the principal is a member of the context.Membership getMembership(String contextId)
This method requires Read access to the context.
contextId
- the membership context.Membership getMembershipByPath(String path)
This method requires Read access to the context.
path
- the repository path for which membership. This can be a folder path, file path,
context path, or any other repository type in the system.Membership updateMembership(Membership membership) throws InvalidMemberException
membership
- the membership list to modify.InvalidMemberException
- thrown when the membership list contains principals that are invalid for the context.Set<Principal> getPotentialMembers(String contextId, boolean checkParentsIfRequired)
checkParentsIfRequired
is set to True
, then this method will continue
querying the parents until either potential members are found or the top of the membership hierarchy is reached.
Read access to the context is required by this method and parents if required.
contextId
- the membership context.checkParentsIfRequired
- if True
, then the search is recursive.Set<Principal> getAssignedMembers(String contextId)
This method requires Read access to the context.
contextId
- the membership context.Set<MembershipDescriptor> getMemberships(Principal member)
member
- the principal.<i>Copyright (c) 2020, SAS Institute Inc., Cary, NC, USA</i>