public final class MemberManager extends Object
Modifier and Type | Field and Description |
---|---|
protected PSSession |
_session
The user connecting to the server.
|
Constructor and Description |
---|
MemberManager(PSSession session)
Creates a new member manager using the specified session.
|
Modifier and Type | Method and Description |
---|---|
boolean |
activate(String username)
Activate an account for administrators only.
|
static boolean |
activate(String username,
String key)
Activate an account.
|
boolean |
confirmEmailChange(String username,
String email,
String key)
Allow members to confirm a change of email address by supplying a confirmation key.
|
void |
create(PSMember member,
MemberOptions options)
Saves the details of the specified member.
|
void |
create(PSMember member,
MemberOptions options,
String password)
Saves the details of the specified member.
|
boolean |
forceResetPassword(PSGroup group,
String member)
Force the password of a user to be reset (administrators only)
|
boolean |
forceResetPassword(String member)
Force the password of a user to be reset (administrators only).
|
PSMember |
get(PSMember member)
Returns the specified member.
|
PSMember |
getByUsername(String username)
Returns the member for the specified username.
|
static PSEntityCache<PSMember> |
getCache()
Returns the member cache.
|
static PSSession |
login(String username,
String password)
Creates a session on PageSeeder from the specified username and password.
|
boolean |
logout()
Logout the user from the current session in PageSeeder.
|
static boolean |
logout(PSSession session)
Logout the user from the current session in PageSeeder.
|
boolean |
resetPassword(PSGroup group,
String member)
Request that the password for the user be reset.
|
boolean |
resetPassword(PSGroup group,
String member,
PasswordResetOptions options)
Confirm a password reset for the specified user with a key.
|
boolean |
resetPassword(String member)
Request that the password for the user be reset.
|
boolean |
resetPassword(String member,
PasswordResetOptions options)
Confirm a password reset for the specified user with a key.
|
boolean |
resetSession()
Resets the session for this user in PageSeeder ensuring that their session includes all
updates made to group membership.
|
boolean |
save(PSMember member)
Saves the details of the specified member.
|
PSSession |
session() |
protected final PSSession _session
public MemberManager(PSSession session)
session
- The session used to connect to PageSeeder.public PSMember getByUsername(String username) throws APIException
username
- The username of that memberAPIException
public void create(PSMember member, MemberOptions options) throws APIException
member
- The username of that memberoptions
- The options to create the member.APIException
public void create(PSMember member, MemberOptions options, String password) throws APIException
member
- The username of that memberoptions
- The options to create the member.password
- The member's passwordAPIException
public PSMember get(PSMember member) throws APIException
member
- The member (id or username must be set).APIException
public boolean save(PSMember member) throws APIException
activate(String)
instead.member
- The member to saveAPIException
public boolean resetSession() throws APIException
This is required after a member has been joined to a group.
true
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting.public boolean forceResetPassword(String member) throws APIException
member
- The username or email of the member.true
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting.public boolean forceResetPassword(PSGroup group, String member) throws APIException
This method is useful to use the email templates for the group; the member does not have to be a member of that group if using the session of a member of the group.
group
- The group to use for the email templates.member
- The username or email of the member.true
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting or the group is not identifiablepublic boolean resetPassword(String member) throws APIException
member
- The username or email of the member.true
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting.public boolean resetPassword(PSGroup group, String member) throws APIException
This method is useful to use the email templates for the group; the member does not have to be a member of that group if using the session of a member of the group.
group
- The group to use for the email templates.member
- The username or email of the member.true
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting or the group is not identifiablepublic boolean resetPassword(String member, PasswordResetOptions options) throws APIException
member
- The username or email of the member.options
- The password reset options, must include the keytrue
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting or the key is missing.public boolean resetPassword(PSGroup group, String member, PasswordResetOptions options) throws APIException
This method is useful to use the email templates for the group; the member does not have to be a member of that group if using the session of a member of the group.
group
- The group to use for the email templatesmember
- The username or email of the member.options
- The password reset options, must include the keytrue
if the request was successful; false
otherwise.APIException
- If an error occurs while connecting or the group is not identifiable or key is missingpublic boolean logout() throws APIException
This will invalidate the session on PageSeeder. After calling this method, other methods will fail if the call requires
true
if the user was successfully logout;
false
if it was not.APIException
- If an error occurs while connecting to PageSeeder.public boolean activate(String username) throws APIException
If the session does not belong to an administrator the call will fail.
username
- The username of the member to activateAPIException
- If an error occurs while connecting to PageSeeder.public static boolean activate(String username, String key) throws APIException
No session is required; since the user is not logged in .
username
- The username of the member to activatekey
- The key the required for activation.APIException
- If an error occurs while connecting to PageSeeder.public static PSSession login(String username, String password) throws APIException
username
- The usernamepassword
- The password to loginnull
otherwise.APIException
- If an error occurs while connecting to PageSeeder.public boolean confirmEmailChange(String username, String email, String key) throws APIException
username
- the member's usernameemail
- the new email addresskey
- the key (emailed to the new email address)true
if successful.APIException
- If an error occurs while connecting to PageSeeder.public static boolean logout(PSSession session) throws APIException
This will invalidate the session on PageSeeder, the session should no longer be used and be discarded.
session
- The session to use to logout.true
if the user was successfully logout;
false
if it was not.APIException
- If an error occurs while connecting to PageSeeder.public static PSEntityCache<PSMember> getCache()
public PSSession session()
Copyright © 2016 Allette Systems. All rights reserved.