public final class MembershipManager extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MembershipManager.MembershipResult
The results of creating a membership operation.
|
Modifier and Type | Field and Description |
---|---|
protected PSSession |
_session
The user connecting to the server.
|
Constructor and Description |
---|
MembershipManager(PSSession session)
Creates a new manager for membership using the specified session.
|
Modifier and Type | Method and Description |
---|---|
MembershipManager.MembershipResult |
add(PSMembership membership,
boolean email)
Add a member to a group directly (Admin only).
|
MembershipManager.MembershipResult |
add(PSMembership membership,
MemberOptions options)
Add a member to a group directly (Admin only).
|
MembershipManager.MembershipResult |
create(PSMembership membership)
Creates the specified membership in PageSeeder.
|
MembershipManager.MembershipResult |
create(PSMembership membership,
String password)
Creates the specified membership in PageSeeder.
|
MembershipManager.MembershipResult |
create(PSMembership membership,
String password,
MemberOptions options)
Creates the specified membership in PageSeeder.
|
List<PSMembership> |
find(PSMembership membership,
boolean isManager)
Returns the list of memberships for specific group matching the values of the specified membership instance.
|
PSMembership |
get(PSGroup group,
PSMember member)
Returns the membership information for the given group and member.
|
PSMembership |
get(String group,
String member)
Returns the membership information for the given group and member.
|
PSMembership |
getAuto(String group,
String emailOrUsername,
boolean isManager)
Returns the membership information for the given group and email or username of member.
|
static PSEntityCache<PSMembership> |
getCache() |
MembershipManager.MembershipResult |
invite(PSMembership membership)
Invite a member to the group.
|
MembershipManager.MembershipResult |
invite(PSMembership membership,
boolean email)
Invite a member to the group.
|
MembershipManager.MembershipResult |
invite(PSMembership membership,
MemberOptions options)
Create a membership by inviting the member to the group.
|
MembershipManager.MembershipResult |
inviteSelf(PSMembership membership)
Create a membership by letting the member inviting herself to the group.
|
MembershipManager.MembershipResult |
inviteSelf(PSMembership membership,
boolean email)
Create a membership by letting the member inviting herself to the group.
|
List<PSMembership> |
listForGroup(PSGroup group)
Returns the list of memberships for specific group.
|
List<PSMembership> |
listForGroup(PSGroup group,
boolean includeSubgroups)
Returns the list of memberships for specific group.
|
List<PSMembership> |
listForMember(PSMember member) |
List<PSMembership> |
listForMember(String username)
Returns the list of membership for specific user.
|
MembershipManager.MembershipResult |
register(PSMembership membership)
Creates the specified membership in PageSeeder.
|
void |
remove(String group,
String member)
Remove the specified member from the group.
|
MembershipManager.MembershipResult |
save(PSMembership membership)
Saves the specified membership in PageSeeder.
|
MembershipManager.MembershipResult |
save(PSMembership membership,
boolean forceEmail)
Saves the specified membership in PageSeeder.
|
PSSession |
session() |
void |
updatePassword(PSMembership membership,
String password)
Updates the password of the member.
|
protected final PSSession _session
public MembershipManager(PSSession session)
session
- The session used to connect to PageSeeder.public MembershipManager.MembershipResult create(PSMembership membership) throws APIException
membership
- The Membership to create.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult create(PSMembership membership, String password) throws APIException
membership
- The Membership to create.password
- The password for the user (must be strong enough)APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult create(PSMembership membership, String password, MemberOptions options) throws APIException
membership
- The Membership to create.password
- The password for the user (must be strong enough)options
- The member optionsAPIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult add(PSMembership membership, boolean email) throws APIException
membership
- The membership to create.email
- true
to send a welcome email; false
to silently add the member.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult add(PSMembership membership, MemberOptions options) throws APIException
membership
- The membership to create.options
- The MemberOptions
APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult invite(PSMembership membership) throws APIException
This method will use the default options by sending a welcome email and an invitation based on the group properties.
membership
- The membership to create.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult invite(PSMembership membership, boolean email) throws APIException
membership
- The membership to create.email
- true
to send a welcome email;
false
to silently add the member.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult invite(PSMembership membership, MemberOptions options) throws APIException
Only the invitation
and sendWelcomeEmail
are considered.
membership
- The membership to create.options
- The member options.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult inviteSelf(PSMembership membership) throws APIException
A welcome email will be sent to the user.
membership
- The membership to create.APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult inviteSelf(PSMembership membership, boolean email) throws APIException
membership
- The membership to create.email
- true
to send the welcome email;
false
otherwise (the member is added silently)APIException
- if the operation is not successful or caused by client.public MembershipManager.MembershipResult register(PSMembership membership) throws APIException
membership
- The Membership to create.APIException
- if the operation is not successful or caused by client.public PSMembership get(String group, String member) throws APIException
group
- The name of the group.member
- The username of the member.null
if the member does not belong to the groupAPIException
public PSMembership getAuto(String group, String emailOrUsername, boolean isManager) throws APIException
group
- The name of the group.emailOrUsername
- The username or email of the member.isManager
- true
to indicate that the user is a manager.null
if the member does not belong to the groupAPIException
public PSMembership get(PSGroup group, PSMember member) throws APIException
group
- The group instance.member
- The member instance.null
if the member does not belong to the groupAPIException
public void remove(String group, String member) throws APIException
group
- The group the member is to be removed frommember
- The username of the memberAPIException
public MembershipManager.MembershipResult save(PSMembership membership) throws APIException
membership
- The Membership to create.APIException
public MembershipManager.MembershipResult save(PSMembership membership, boolean forceEmail) throws APIException
membership
- The Membership to create.forceEmail
- A boolean to force email changeAPIException
public void updatePassword(PSMembership membership, String password) throws APIException
APIException
public List<PSMembership> listForMember(PSMember member) throws APIException
APIException
public List<PSMembership> listForMember(String username) throws APIException
username
- the member usernameAPIException
public List<PSMembership> listForGroup(PSGroup group) throws APIException
group
- the name of the group.APIException
public List<PSMembership> listForGroup(PSGroup group, boolean includeSubgroups) throws APIException
group
- the name of the group.includeSubgroups
- if members from subgroups should be includedAPIException
public List<PSMembership> find(PSMembership membership, boolean isManager) throws APIException
membership
- search predicate.isManager
- true
to indicate that the user is a manager.APIException
public static PSEntityCache<PSMembership> getCache()
public PSSession session()
Copyright © 2016 Allette Systems. All rights reserved.