2013-07-26 17:38:56 +02:00
|
|
|
package org.gcube.vomanagement.usermanagement;
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.RoleRetrievalFault;
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.UserManagementSystemException;
|
|
|
|
import org.gcube.vomanagement.usermanagement.exception.UserRetrievalFault;
|
2016-02-08 17:48:05 +01:00
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
2013-07-26 17:38:56 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This interface defines the manager class that manages the roles.
|
|
|
|
*
|
2016-02-10 17:59:03 +01:00
|
|
|
* @author Massimiliano Assante, CNR-ISTI
|
2013-07-26 17:38:56 +02:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
public interface RoleManager {
|
2016-02-10 17:59:03 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param userId the LR UserId, not the username
|
|
|
|
* @return true if the user is a portal administrator, false otherwise
|
|
|
|
* @throws UserRetrievalFault
|
|
|
|
*/
|
|
|
|
boolean isAdmin(long userId) throws UserRetrievalFault;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param userId the LR UserId
|
|
|
|
* @param groupId the LR groupId
|
|
|
|
* @param roleId the LR roleId
|
|
|
|
* @return
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
* @throws UserRetrievalFault
|
|
|
|
* @throws GroupRetrievalFault
|
|
|
|
* @throws RoleRetrievalFault
|
|
|
|
*/
|
|
|
|
boolean assignRoleToUser(long userId, long groupId, long roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,RoleRetrievalFault;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param userId the LR UserId
|
|
|
|
* @param groupId the LR groupId
|
|
|
|
* @param roleId the LR roleId
|
|
|
|
* @return
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
* @throws UserRetrievalFault
|
|
|
|
* @throws GroupRetrievalFault
|
|
|
|
* @throws RoleRetrievalFault
|
|
|
|
*/
|
|
|
|
boolean assignRolesToUser(long userId, long groupId, long[] roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,RoleRetrievalFault;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleName
|
|
|
|
* @param roleDescription
|
|
|
|
* @return true if the role is created succesfully
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
*/
|
|
|
|
boolean createRole(String roleName, String roleDescription) throws UserManagementSystemException;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleId
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
* @throws RoleRetrievalFault
|
|
|
|
*/
|
|
|
|
boolean deleteRole(long roleId) throws UserManagementSystemException, RoleRetrievalFault ;
|
2016-03-21 11:40:55 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param userId
|
|
|
|
* @param groupId
|
|
|
|
* @param roleId
|
|
|
|
* @return
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
* @throws UserRetrievalFault
|
|
|
|
* @throws GroupRetrievalFault
|
|
|
|
* @throws RoleRetrievalFault
|
|
|
|
*/
|
2016-02-10 17:59:03 +01:00
|
|
|
boolean removeRoleFromUser(long userId, long groupId, long roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,RoleRetrievalFault;
|
2016-03-21 11:40:55 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleId
|
|
|
|
* @param roleName
|
|
|
|
* @param roleDescription
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
GCubeRole updateRole(long roleId, String roleName, String roleDescription) throws RoleRetrievalFault;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleId
|
|
|
|
* @return
|
|
|
|
* @throws UserManagementSystemException
|
|
|
|
* @throws RoleRetrievalFault
|
|
|
|
*/
|
2016-02-10 17:59:03 +01:00
|
|
|
GCubeRole getRole(long roleId) throws UserManagementSystemException, RoleRetrievalFault;
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleName
|
|
|
|
* @param groupId the LR groupId
|
|
|
|
* @return an instance of {@link GcubeRole} if the roleName exists, null otherwise
|
2016-02-29 15:45:56 +01:00
|
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
|
|
|
* @throws GroupRetrievalFault if the groupId does not exist
|
2016-02-10 17:59:03 +01:00
|
|
|
*/
|
2016-02-29 15:45:56 +01:00
|
|
|
GCubeRole getRole(String roleName, long groupId) throws RoleRetrievalFault, GroupRetrievalFault;
|
2016-02-10 17:59:03 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param roleName
|
|
|
|
* @param groupId the LR groupId
|
2016-02-29 15:45:56 +01:00
|
|
|
* @return the LR RoleId if the roleName exists
|
|
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
|
|
|
* @throws GroupRetrievalFault if the groupId does not exist
|
2016-02-10 17:59:03 +01:00
|
|
|
*/
|
2016-02-29 15:45:56 +01:00
|
|
|
long getRoleId(String roleName, long groupId) throws RoleRetrievalFault, GroupRetrievalFault;
|
2016-02-10 17:59:03 +01:00
|
|
|
/**
|
|
|
|
*
|
2016-02-29 15:45:56 +01:00
|
|
|
* @param roleName
|
|
|
|
* @return the LR RoleId if the roleName exists
|
|
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
2016-02-10 17:59:03 +01:00
|
|
|
*/
|
2016-02-29 15:45:56 +01:00
|
|
|
long getRoleIdByName(String roleName) throws RoleRetrievalFault;
|
2016-02-10 17:59:03 +01:00
|
|
|
/**
|
|
|
|
*
|
2016-02-29 15:45:56 +01:00
|
|
|
* @return a list of {@link GcubeRole} independent from the roleType
|
|
|
|
*/
|
|
|
|
List<GCubeRole> listAllRoles();
|
|
|
|
/**
|
2016-02-10 17:59:03 +01:00
|
|
|
* @return a list of {@link GcubeRole} of type Site Role (Type=2)
|
|
|
|
*/
|
2016-02-29 15:45:56 +01:00
|
|
|
List<GCubeRole> listAllGroupRoles();
|
2016-02-10 17:59:03 +01:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param groupId
|
|
|
|
* @param userId
|
|
|
|
* @return a list of {@link GcubeRole} of type Site Role (Type=2)
|
|
|
|
* @throws GroupRetrievalFault
|
|
|
|
* @throws UserRetrievalFault
|
|
|
|
*/
|
2016-02-29 15:45:56 +01:00
|
|
|
List<GCubeRole> listRolesByUserAndGroup(long userId, long groupId) throws GroupRetrievalFault,UserRetrievalFault;
|
2013-07-26 17:38:56 +02:00
|
|
|
|
|
|
|
}
|