Class LiferayUserManager
java.lang.Object
org.gcube.vomanagement.usermanagement.impl.LiferayUserManager
- All Implemented Interfaces:
UserManager
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionacceptMembershipRequest(long requestUserId, long groupId, boolean addUserToGroup, String replyUsername, String replyComment) accept a membership request and optionally add the user to the groupvoidassignUserToGroup(long groupId, long userId) this method assigns the user to the Group and perform other necessary actions (such as adding him to the HL Folder)createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, byte[] portraitBytes, int type) Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password.createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, byte[] portraitBytes, String mySpacesn, String twittersn, String facebooksn, String skypesn, String jabbersn, String aimsn, int type) Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password.createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, int type) Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password.createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, int type) Create the user without sending notification mail and without forcing him to change the password at first login.voiddeleteUserByEMail(String email) Delete a user given his mailvoiddismissUserFromGroup(long groupId, long userId) this method removes the user to the Group and perform other necessary actions (such as removing him from the HL Folder)static com.liferay.portal.kernel.model.UsergetAdmin()getFullNameFromEmail(String email) Returns the user's full name given his emailintgetGroupUsersCount(long groupId) Returns the number of users in the group (VRE).getMembershipRequests(long userId, long groupId, MembershipRequestStatus requestStatus) getMembershipRequestsById(long membershipRequestId) static com.liferay.portal.kernel.model.UsergetRandomUserWithRole(long contextGroupId, GatewayRolesNames gatewayRole) static com.liferay.portal.kernel.model.RolegetRoleById(long companyId, String roleStrId) byte[]getUserAvatarBytes(String screenName) Retrieve user's avatar as bytesgetUserByEmail(String emailAddress) getUserById(long userId) getUserByScreenName(String username) Deprecated.getUserByUsername(String username) getUserContactsByGroup(long userId, long scopeGroupId) longgetUserIdsByGroup(long groupId) Retrieve the list of user identifiers by group id.getUserOpenId(String screenName) Retrieve user's openId fieldgetUserProfessionalBackground(long userId) intReturns the number of total users.booleanisPasswordChanged(String emailAddress) Check if the user changed his/her password from the initial one.listMembershipRequestsByGroup(long groupId) listPendingMembershipRequestsByGroup(long groupId) listUnregisteredUsersByGroup(long groupId) long[]listUserIdsByGroupAndRole(long groupId, long roleId) listUsers(boolean indexed) listUsers(int start, int end) Returns a range of all the users.listUsersAndRolesByGroup(long groupId) listUsersByGlobalRole(long roleId) Retrieve a list of users having a global role (e.g., Administrator)listUsersByGroup(long groupId) listUsersByGroup(long groupId, boolean indexed) listUsersByGroup(long groupId, int start, int end) listUsersByGroupAndRole(long groupId, long roleId) listUsersByGroupName(String name) listUsersByTeam(long teamId) /**readCustomAttr(long userId, String attributeKey) rejectMembershipRequest(long requestUserId, long groupId, String replyUsername, String replyComment) rejects a membership requestrequestMembership(long userId, long groupId, String comment) request the membership to a restricted Site, no further actions are performed (no emails are sent, nor notifications)voidsaveCustomAttr(long userId, String attributeKey, Serializable value) searchUsersByGroup(String keywords, long groupId) voidsetUserProfessionalBackground(long userId, String summary) Save the user professional backgroundbooleanupdateContactInformation(String screenName, String mySpacesn, String twittersn, String facebooksn, String skypesn, String jabbersn, String aimsn) Update screenName user's contact informationbooleanupdateJobTitle(long userId, String theJob) booleanuserExistsByEmail(String emailAddress) Check if a user with such email exists.
-
Constructor Details
-
LiferayUserManager
public LiferayUserManager()
-
-
Method Details
-
getAdmin
public static com.liferay.portal.kernel.model.User getAdmin() -
getRandomUserWithRole
public static com.liferay.portal.kernel.model.User getRandomUserWithRole(long contextGroupId, GatewayRolesNames gatewayRole) - Parameters:
contextGroupId-gatewayRole-- Returns:
- the User if a user having the role exists in the Site group (Gateway, VO or VRE)
-
getRoleById
-
createUser
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, int type) throws UserManagementSystemException Create the user without sending notification mail and without forcing him to change the password at first login.- Specified by:
createUserin interfaceUserManager- Parameters:
autoScreenName- set true if you want liferay to auto generate a screename for this user, false otherwiseusername- the username of the user you wantemail- a valid email address- Returns:
- an instance of the yet created user
- Throws:
UserManagementSystemException
-
createUser
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, int type) throws UserManagementSystemException Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password.- Specified by:
createUserin interfaceUserManager- Parameters:
autoScreenName- set true if you want liferay to auto generate a screename for this user, false otherwiseusername- the username of the user you wantemail- a valid email address- Returns:
- an instance of the yet created user
- Throws:
UserManagementSystemException
-
createUser
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, byte[] portraitBytes, int type) throws UserManagementSystemException Create the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password. You can also pass the avatar to set as bytes.- Specified by:
createUserin interfaceUserManager- Parameters:
autoScreenName- set true if you want liferay to auto generate a screename for this user, false otherwiseusername- the username of the user you wantemail- a valid email addressportraitBytes- the bytes of the avatar to use for the usertype- the type of user- Returns:
- an instance of the yet created user
- Throws:
UserManagementSystemException- if a system exception occurs
-
createUser
public GCubeUser createUser(boolean autoScreenName, String username, String email, String firstName, String middleName, String lastName, String jobTitle, String location_industry, String backgroundSummary, boolean male, String reminderQuestion, String reminderAnswer, boolean sendEmail, boolean forcePasswordReset, byte[] portraitBytes, String mySpacesn, String twittersn, String facebooksn, String skypesn, String jabbersn, String aimsn, int type) throws UserManagementSystemException Description copied from interface:UserManagerCreate the user and let you choose if you want to send him/her a mail notification and force or not the user to change his/her password. You can also pass the avatar to set as bytes. Moreover, contact information can be passed.- Specified by:
createUserin interfaceUserManagermySpacesn- please note that this field will be used for Linkedin information!!- Returns:
- Throws:
UserManagementSystemException
-
getUserByUsername
public GCubeUser getUserByUsername(String username) throws UserManagementSystemException, UserRetrievalFault - Specified by:
getUserByUsernamein interfaceUserManager- Parameters:
username- the username of the user you want to get- Returns:
- the instance of the user
- Throws:
UserManagementSystemExceptionUserRetrievalFault
-
getUserByScreenName
@Deprecated public GCubeUser getUserByScreenName(String username) throws UserManagementSystemException, UserRetrievalFault Deprecated.- Specified by:
getUserByScreenNamein interfaceUserManager- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFault
-
getUserById
- Specified by:
getUserByIdin interfaceUserManager- Parameters:
userId- the LR UserId- Returns:
- the instance of the user
- Throws:
UserManagementSystemExceptionUserRetrievalFault
-
getUserProfessionalBackground
public String getUserProfessionalBackground(long userId) throws UserManagementSystemException, UserRetrievalFault - Specified by:
getUserProfessionalBackgroundin interfaceUserManager- Parameters:
userId- the LR UserId- Returns:
- the user professional background
- Throws:
UserManagementSystemExceptionUserRetrievalFault
-
setUserProfessionalBackground
public void setUserProfessionalBackground(long userId, String summary) throws UserManagementSystemException, UserRetrievalFault Description copied from interface:UserManagerSave the user professional background- Specified by:
setUserProfessionalBackgroundin interfaceUserManager- Throws:
UserManagementSystemException- if a system exception occursUserRetrievalFault- if the user does not exist
-
getUserByEmail
public GCubeUser getUserByEmail(String emailAddress) throws UserManagementSystemException, UserRetrievalFault - Specified by:
getUserByEmailin interfaceUserManager- Parameters:
emailAddress- the email of the user you want to get- Returns:
- the instance of the user
- Throws:
UserManagementSystemException- if a system exception occursUserRetrievalFault- if the user does not exist
-
getUserId
- Specified by:
getUserIdin interfaceUserManager- Parameters:
screenName- the LR screenname- Returns:
- the LR userId associated to this screenname
- Throws:
UserManagementSystemExceptionUserRetrievalFault
-
listUsers
- Specified by:
listUsersin interfaceUserManager- Parameters:
indexed- set to true to use the indexed version search false for a real time query to the DB.- Returns:
- a list of all portal active users no matter if the belong or not to a VRE, if a user is deactived is not returned
- Throws:
UserManagementSystemException
-
listUsers
- Specified by:
listUsersin interfaceUserManager- Returns:
- a list of all portal active users (using indexed version search) no matter if the belong or not to a VRE, if a user is deactived is not returned
- Throws:
UserManagementSystemException
-
listUsers
Returns a range of all the users. Useful when paginating results. Returns a maximum of end - start instances, 0 refers to the first result in the set.- Specified by:
listUsersin interfaceUserManager- Parameters:
start- start the lower bound of the range of usersend- end the upper bound of the range of users (not inclusive)- Returns:
- the range of users
- Throws:
UserManagementSystemException
-
getUsersCount
Returns the number of total users.- Specified by:
getUsersCountin interfaceUserManager- Returns:
- the number of users
- Throws:
UserManagementSystemException
-
listUsersByGroup
public List<GCubeUser> listUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUsersByGroupin interfaceUserManager- Parameters:
groupId- the LR groupId- Returns:
- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
listUsersByGroup
public List<GCubeUser> listUsersByGroup(long groupId, int start, int end) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUsersByGroupin interfaceUserManager- Parameters:
groupId- the LR groupId- Returns:
- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
getGroupUsersCount
Returns the number of users in the group (VRE).- Specified by:
getGroupUsersCountin interfaceUserManager- Returns:
- the number of users in the group (VRE).
- Throws:
GroupRetrievalFault
-
listUsersByGroup
public List<GCubeUser> listUsersByGroup(long groupId, boolean indexed) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUsersByGroupin interfaceUserManager- Parameters:
groupId- the LR groupIdindexed- set to true to use the indexed version search false for a real time query to the DB.- Returns:
- a list of all portal active users belonging to the given groupid
- Throws:
UserManagementSystemException- if a system exception occursGroupRetrievalFault- if the group does not existUserRetrievalFault- .
-
searchUsersByGroup
- Specified by:
searchUsersByGroupin interfaceUserManager- Parameters:
keywords- the keywords (space separated), which may occur in the user's first name, middle name, last name, username, or email address- Returns:
- all the users who match the keywords ordered by username (Ascendent order)
- Throws:
GroupRetrievalFault- if the group does not exist
-
listUsersByGroupName
public List<GCubeUser> listUsersByGroupName(String name) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUsersByGroupNamein interfaceUserManager- Parameters:
name- the name of the VO or VRE (e.g. devVRE, or gcube etc.)- Returns:
- a list of users
- Throws:
UserManagementSystemException- if a system exception occursGroupRetrievalFaultUserRetrievalFault
-
listUsersAndRolesByGroup
public Map<GCubeUser,List<GCubeRole>> listUsersAndRolesByGroup(long groupId) throws GroupRetrievalFault, UserManagementSystemException, UserRetrievalFault - Specified by:
listUsersAndRolesByGroupin interfaceUserManager- Parameters:
groupId- the LR groupId- Returns:
- the list of
GCubeUserwith their GCubeRole given the LR GroupId - Throws:
GroupRetrievalFaultUserManagementSystemExceptionUserRetrievalFault
-
listUsersByGroupAndRole
public List<GCubeUser> listUsersByGroupAndRole(long groupId, long roleId) throws UserManagementSystemException, RoleRetrievalFault, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUsersByGroupAndRolein interfaceUserManager- Parameters:
groupId- the LR groupIdroleId- the LR roleId- Returns:
- the list of
GCubeUserhaving group and role that matches - Throws:
UserManagementSystemExceptionGroupRetrievalFault- if the group does not existUserRetrievalFaultRoleRetrievalFault
-
listUserIdsByGroupAndRole
public long[] listUserIdsByGroupAndRole(long groupId, long roleId) - Specified by:
listUserIdsByGroupAndRolein interfaceUserManager- Returns:
- the list of userId having group and role that matches
-
listUsersByTeam
public List<GCubeUser> listUsersByTeam(long teamId) throws UserManagementSystemException, TeamRetrievalFault, UserRetrievalFault /**- Specified by:
listUsersByTeamin interfaceUserManager- Parameters:
teamId- the LR teamId- Returns:
- the list of
GCubeUserhaving teamId that matches - Throws:
UserManagementSystemExceptionTeamRetrievalFault- if the team does not existUserRetrievalFault
-
getUserContactsByGroup
public Set<GCubeUser> getUserContactsByGroup(long userId, long scopeGroupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
getUserContactsByGroupin interfaceUserManager- Parameters:
userId- the LR userid for which you need to fetch the contactsscopeGroupId- the liferay groupid number of the current Site- Returns:
- a set containing all portal active users that the user can contact/see (depending on the scopeGroupId he/she can see the users a VRE, or the users of all the VREs he/she is subscribed)
- Throws:
UserManagementSystemException- .GroupRetrievalFault- .UserRetrievalFault- .
-
listMembershipRequestsByGroup
public List<GCubeMembershipRequest> listMembershipRequestsByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listMembershipRequestsByGroupin interfaceUserManager- Parameters:
groupId- the LR groupId- Returns:
- the list of
GCubeMembershipRequestwith their status and users given the LR GroupId (status can be requested, approved or rejected, @seeMembershipRequestStatus - Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
listPendingMembershipRequestsByGroup
public List<GCubeMembershipRequest> listPendingMembershipRequestsByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listPendingMembershipRequestsByGroupin interfaceUserManager- Parameters:
groupId- the LR groupId- Returns:
- the list of
GCubeMembershipRequestwith status requested and users given the LR GroupId @seeMembershipRequestStatus - Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
requestMembership
public GCubeMembershipRequest requestMembership(long userId, long groupId, String comment) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault request the membership to a restricted Site, no further actions are performed (no emails are sent, nor notifications)- Specified by:
requestMembershipin interfaceUserManager- Parameters:
userId- the LR useridgroupId- the LR groupId thecomment- a comment to the request must not be null- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
acceptMembershipRequest
public GCubeMembershipRequest acceptMembershipRequest(long requestUserId, long groupId, boolean addUserToGroup, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException accept a membership request and optionally add the user to the group- Specified by:
acceptMembershipRequestin interfaceUserManager- Parameters:
requestUserId- the LR userid of the requestgroupId- the LR groupIdaddUserToGroup- if you want it to also add the user to the groupreplyUsername- the username (screenname) of the user accepting the requestreplyComment- a comment attachd to the reply (must not be null)- Throws:
UserManagementSystemException- if a system exception occursGroupRetrievalFaultUserManagementPortalException
-
rejectMembershipRequest
public GCubeMembershipRequest rejectMembershipRequest(long requestUserId, long groupId, String replyUsername, String replyComment) throws UserManagementSystemException, GroupRetrievalFault, UserManagementPortalException rejects a membership request- Specified by:
rejectMembershipRequestin interfaceUserManager- Parameters:
requestUserId- the LR userid of the requestgroupId- the LR groupIdreplyUsername- the username (screenname) of the user accepting the requestreplyComment- a comment attachd to the reply (must not be null)- Throws:
UserManagementSystemException- if a system exception occursGroupRetrievalFaultUserManagementPortalException
-
getMembershipRequestsById
- Specified by:
getMembershipRequestsByIdin interfaceUserManager- Parameters:
membershipRequestId- the id of the request- Returns:
- an istance of
GCubeMembershipRequest
-
getMembershipRequests
public List<GCubeMembershipRequest> getMembershipRequests(long userId, long groupId, MembershipRequestStatus requestStatus) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
getMembershipRequestsin interfaceUserManager- Parameters:
userId- the LR useridgroupId- the LR groupId therequestStatus- an istance ofMembershipRequestStatus- Returns:
- the list of
GCubeMembershipRequestwith their status and users given the LR GroupId and userId (status can be requested, approved or rejected, @seeMembershipRequestStatus - Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
assignUserToGroup
public void assignUserToGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault, UserManagementPortalException this method assigns the user to the Group and perform other necessary actions (such as adding him to the HL Folder)- Specified by:
assignUserToGroupin interfaceUserManager- Parameters:
groupId- LR groupIduserId- LR userId- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFaultUserManagementPortalException
-
dismissUserFromGroup
public void dismissUserFromGroup(long groupId, long userId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault this method removes the user to the Group and perform other necessary actions (such as removing him from the HL Folder)- Specified by:
dismissUserFromGroupin interfaceUserManager- Parameters:
groupId- LR groupIduserId- LR userId- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
listUnregisteredUsersByGroup
public List<GCubeUser> listUnregisteredUsersByGroup(long groupId) throws UserManagementSystemException, GroupRetrievalFault, UserRetrievalFault - Specified by:
listUnregisteredUsersByGroupin interfaceUserManager- Parameters:
groupId- LR groupId- Returns:
- all the users of the portal not belonging to the groupId
- Throws:
UserManagementSystemExceptionGroupRetrievalFaultUserRetrievalFault
-
isPasswordChanged
Description copied from interface:UserManagerCheck if the user changed his/her password from the initial one.- Specified by:
isPasswordChangedin interfaceUserManager- Parameters:
emailAddress- the email of the user to consider- Returns:
- true if the password has been changed, false if it has been not or the user doesn't exist.
-
userExistsByEmail
Description copied from interface:UserManagerCheck if a user with such email exists.- Specified by:
userExistsByEmailin interfaceUserManager- Returns:
- true on success, false otherwise
-
getFullNameFromEmail
Description copied from interface:UserManagerReturns the user's full name given his email- Specified by:
getFullNameFromEmailin interfaceUserManager- Returns:
- null on failure
-
deleteUserByEMail
public void deleteUserByEMail(String email) throws UserManagementSystemException, UserManagementPortalException, com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException Description copied from interface:UserManagerDelete a user given his mail- Specified by:
deleteUserByEMailin interfaceUserManager- Throws:
UserManagementSystemExceptionUserManagementPortalExceptioncom.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemException
-
getUserAvatarBytes
Description copied from interface:UserManagerRetrieve user's avatar as bytes- Specified by:
getUserAvatarBytesin interfaceUserManager
-
getUserOpenId
Description copied from interface:UserManagerRetrieve user's openId field- Specified by:
getUserOpenIdin interfaceUserManager
-
updateContactInformation
public boolean updateContactInformation(String screenName, String mySpacesn, String twittersn, String facebooksn, String skypesn, String jabbersn, String aimsn) Description copied from interface:UserManagerUpdate screenName user's contact information- Specified by:
updateContactInformationin interfaceUserManagermySpacesn- used for linkedin contact info- Returns:
- true on success, false otherwise
-
readCustomAttr
- Specified by:
readCustomAttrin interfaceUserManagerattributeKey- the name of the attribute you want to read its value- Returns:
- the attributeKey value if existing, null otherwise
- Throws:
UserRetrievalFault
-
saveCustomAttr
public void saveCustomAttr(long userId, String attributeKey, Serializable value) throws UserRetrievalFault - Specified by:
saveCustomAttrin interfaceUserManagerattributeKey- the name of the attribute you want to savevalue- the value- Throws:
UserRetrievalFault
-
updateJobTitle
- Specified by:
updateJobTitlein interfaceUserManagertheJob- the job headline- Returns:
- true if ok
-
listUsersByGlobalRole
Description copied from interface:UserManagerRetrieve a list of users having a global role (e.g., Administrator)- Specified by:
listUsersByGlobalRolein interfaceUserManager- Returns:
-
getUserIdsByGroup
Description copied from interface:UserManagerRetrieve the list of user identifiers by group id.- Specified by:
getUserIdsByGroupin interfaceUserManager- Returns:
-