Class LiferayRoleManager
java.lang.Object
org.gcube.vomanagement.usermanagement.impl.LiferayRoleManager
- All Implemented Interfaces:
RoleManager
Exploit Liferay JSON Web Service to perform RoleManager's operations.
- Author:
- Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanassignRolesToUser(long userId, long groupId, long[] roleIds) booleanassignRoleToUser(long userId, long groupId, long roleId) booleanassignTeamToUser(long userId, long teamId) associate one team to the existing teams of userbooleancreateRole(String roleName, String roleDescription) createTeam(long userId, long groupId, String teamName, String teamDescription) createTeam(long groupId, String teamName, String teamDescription) it will crate the Team as Administrator, use the other method to pass the userIdbooleandeleteRole(long roleId) deleteTeam(long teamId) booleandeleteTeams(long groupId) booleandeleteUserTeams(long userId, long[] teamIds) delete a user from a list of teamsbooleandeleteUserTeams(long userId, List<GCubeTeam> teams) delete a user from a list of teamsgetRole(long roleId) long* @param roleNamelonggetRoleIdByName(String roleName) * @param roleNamegetTeam(long teamId) booleanhasRole(long userId, long groupId, long roleId) booleanhasTeam(long userId, long teamId) booleanisAdmin(long userId) listRolesByUserAndGroup(long userId, long groupId) listTeamsByGroup(long groupId) listTeamsByUserAndGroup(long userId, long groupId) protected static GCubeRolemapLRRole(com.liferay.portal.kernel.model.Role r) protected static GCubeTeammapLRTeam(com.liferay.portal.kernel.model.Team t) booleanremoveAllRolesFromUser(long userId, long... groupIds) booleanremoveRoleFromUser(long userId, long groupId, long roleId) booleansetUserTeams(long userId, long[] teamIds) associate or not associate teams to a userupdateRole(long roleId, String roleName, String roleDescription) updateTeam(long teamId, String teamName, String teamDescription)
-
Field Details
-
ROLE_TYPE
protected static final int ROLE_TYPE- See Also:
-
-
Constructor Details
-
LiferayRoleManager
public LiferayRoleManager()
-
-
Method Details
-
mapLRRole
protected static GCubeRole mapLRRole(com.liferay.portal.kernel.model.Role r) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException - Throws:
com.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemException
-
mapLRTeam
protected static GCubeTeam mapLRTeam(com.liferay.portal.kernel.model.Team t) throws com.liferay.portal.kernel.exception.PortalException, com.liferay.portal.kernel.exception.SystemException - Throws:
com.liferay.portal.kernel.exception.PortalExceptioncom.liferay.portal.kernel.exception.SystemException
-
isAdmin
- Specified by:
isAdminin interfaceRoleManager- Parameters:
userId- the LR UserId, not the username- Returns:
- true if the user is a portal administrator, false otherwise
- Throws:
UserRetrievalFault
-
getRole
public GCubeRole getRole(String roleName, long groupId) throws RoleRetrievalFault, GroupRetrievalFault - Specified by:
getRolein interfaceRoleManagergroupId- the LR groupId- Returns:
- an instance of
GCubeRoleif the roleName exists, null otherwise - Throws:
RoleRetrievalFault- if the roleName does not existGroupRetrievalFault- if the groupId does not exist
-
getRole
- Specified by:
getRolein interfaceRoleManager- Returns:
- Throws:
RoleRetrievalFault
-
getRoleId
* @param roleName- Specified by:
getRoleIdin interfaceRoleManagergroupId- the LR groupId- Returns:
- the LR RoleId if the roleName exists
- Throws:
RoleRetrievalFault- if the roleName does not existGroupRetrievalFault- if the groupId does not exist
-
getRoleIdByName
* @param roleName- Specified by:
getRoleIdByNamein interfaceRoleManager- Returns:
- the LR RoleId if the roleName exists
- Throws:
RoleRetrievalFault- if the roleName does not exist
-
hasRole
public boolean hasRole(long userId, long groupId, long roleId) - Specified by:
hasRolein interfaceRoleManager- Parameters:
userId- userId the LR UserId, not the usernamegroupId- the LR groupIdroleId- the LR roleId- Returns:
- true if the user has the role, false otherwise
-
hasTeam
public boolean hasTeam(long userId, long teamId) - Specified by:
hasTeamin interfaceRoleManager- Parameters:
userId- userId the LR UserId, not the usernameteamId- the LR teamId- Returns:
-
assignRoleToUser
public boolean assignRoleToUser(long userId, long groupId, long roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, RoleRetrievalFault - Specified by:
assignRoleToUserin interfaceRoleManager- Parameters:
userId- the LR UserIdgroupId- the LR groupIdroleId- the LR roleId- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFaultGroupRetrievalFaultRoleRetrievalFault
-
assignRolesToUser
public boolean assignRolesToUser(long userId, long groupId, long[] roleIds) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, RoleRetrievalFault - Specified by:
assignRolesToUserin interfaceRoleManager- Parameters:
userId- the LR UserIdgroupId- the LR groupIdroleIds- the LR roleId- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFaultGroupRetrievalFaultRoleRetrievalFault
-
createRole
public boolean createRole(String roleName, String roleDescription) throws UserManagementSystemException - Specified by:
createRolein interfaceRoleManager- Returns:
- true if the role is created succesfully
- Throws:
UserManagementSystemException
-
deleteRole
- Specified by:
deleteRolein interfaceRoleManager- Returns:
- true if the role is deleted succesfully, false otherwise
- Throws:
UserManagementSystemExceptionRoleRetrievalFault
-
updateRole
public GCubeRole updateRole(long roleId, String roleName, String roleDescription) throws RoleRetrievalFault - Specified by:
updateRolein interfaceRoleManager- Returns:
- Throws:
RoleRetrievalFault
-
removeRoleFromUser
public boolean removeRoleFromUser(long userId, long groupId, long roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault, RoleRetrievalFault - Specified by:
removeRoleFromUserin interfaceRoleManager- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFaultGroupRetrievalFaultRoleRetrievalFault
-
removeAllRolesFromUser
public boolean removeAllRolesFromUser(long userId, long... groupIds) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault - Specified by:
removeAllRolesFromUserin interfaceRoleManager- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFaultGroupRetrievalFault
-
listAllRoles
- Specified by:
listAllRolesin interfaceRoleManager- Returns:
- a list of
GCubeRoleindependent from the roleType
-
listAllGroupRoles
- Specified by:
listAllGroupRolesin interfaceRoleManager- Returns:
- a list of
GCubeRoleof type Site Role (Type=2)
-
listRolesByUserAndGroup
public List<GCubeRole> listRolesByUserAndGroup(long userId, long groupId) throws GroupRetrievalFault, UserRetrievalFault - Specified by:
listRolesByUserAndGroupin interfaceRoleManager- Returns:
- a list of
GCubeRoleof type Site Role (Type=2) - Throws:
GroupRetrievalFault- if the group does not existUserRetrievalFault- if the user does not exist
-
createTeam
public GCubeTeam createTeam(long userId, long groupId, String teamName, String teamDescription) throws GroupRetrievalFault, TeamRetrievalFault, UserManagementSystemException - Specified by:
createTeamin interfaceRoleManager- Parameters:
userId- the username of who is creating the teamgroupId- the site group id where the team existsteamName- the name you want to assign to this team- Returns:
- the GCubeTeam if the team is created succesfully, null otherwise
- Throws:
UserManagementSystemExceptionGroupRetrievalFaultTeamRetrievalFault
-
createTeam
public GCubeTeam createTeam(long groupId, String teamName, String teamDescription) throws GroupRetrievalFault, TeamRetrievalFault, UserManagementSystemException it will crate the Team as Administrator, use the other method to pass the userId- Specified by:
createTeamin interfaceRoleManager- Parameters:
groupId- the site group id where the team existsteamName- the name you want to assign to this team- Returns:
- the GCubeTeam if the team is created succesfully, null otherwise
- Throws:
UserManagementSystemExceptionGroupRetrievalFaultTeamRetrievalFault
-
deleteTeam
- Specified by:
deleteTeamin interfaceRoleManager- Parameters:
teamId- the LR team Id- Returns:
- the team instance that was removed
- Throws:
UserManagementSystemExceptionTeamRetrievalFault- if the team does not exist
-
deleteTeams
- Specified by:
deleteTeamsin interfaceRoleManager- Parameters:
groupId- the LR GroupId of the Site- Returns:
- true if the teams are deleted succesfully, false otherwise
- Throws:
UserManagementSystemException
-
getTeam
- Specified by:
getTeamin interfaceRoleManager- Returns:
- the GCubeTeam istance
- Throws:
UserManagementSystemExceptionTeamRetrievalFault- if the team does not exist
-
listTeamsByGroup
- Specified by:
listTeamsByGroupin interfaceRoleManager- Returns:
- a list of
GCubeTeambelonging to a give group - Throws:
GroupRetrievalFault
-
listTeamsByUserAndGroup
public List<GCubeTeam> listTeamsByUserAndGroup(long userId, long groupId) throws UserRetrievalFault, GroupRetrievalFault - Specified by:
listTeamsByUserAndGroupin interfaceRoleManager- Parameters:
userId- the LR userId of the SitegroupId- the LR GroupId of the Site- Returns:
- a list of
GCubeTeambelonging to a user in a given group - Throws:
UserRetrievalFaultGroupRetrievalFault
-
updateTeam
public GCubeTeam updateTeam(long teamId, String teamName, String teamDescription) throws TeamRetrievalFault - Specified by:
updateTeamin interfaceRoleManager- Parameters:
teamId- the team idteamName- the team nameteamDescription- the team description- Returns:
- the updated team
- Throws:
TeamRetrievalFault
-
setUserTeams
associate or not associate teams to a user- Specified by:
setUserTeamsin interfaceRoleManager- Returns:
- Throws:
TeamRetrievalFault- if a system exception occurred or a team does not exists
-
deleteUserTeams
public boolean deleteUserTeams(long userId, long[] teamIds) delete a user from a list of teams- Specified by:
deleteUserTeamsin interfaceRoleManager- Returns:
-
deleteUserTeams
delete a user from a list of teams- Specified by:
deleteUserTeamsin interfaceRoleManager- Returns:
-
getTeam
public GCubeTeam getTeam(long groupId, String teamName) throws GroupRetrievalFault, TeamRetrievalFault - Specified by:
getTeamin interfaceRoleManager- Returns:
- Throws:
GroupRetrievalFaultTeamRetrievalFault
-
assignTeamToUser
public boolean assignTeamToUser(long userId, long teamId) throws UserManagementSystemException, UserRetrievalFault, TeamRetrievalFault Description copied from interface:RoleManagerassociate one team to the existing teams of user- Specified by:
assignTeamToUserin interfaceRoleManager- Returns:
- Throws:
UserManagementSystemExceptionUserRetrievalFaultTeamRetrievalFault
-