149 lines
4.6 KiB
Java
149 lines
4.6 KiB
Java
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;
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeRole;
|
|
|
|
/**
|
|
* This interface defines the manager class that manages the roles.
|
|
*
|
|
* @author Massimiliano Assante, CNR-ISTI
|
|
*
|
|
*/
|
|
public interface RoleManager {
|
|
/**
|
|
*
|
|
* @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 ;
|
|
/**
|
|
*
|
|
* @param userId
|
|
* @param groupId
|
|
* @param roleId
|
|
* @return
|
|
* @throws UserManagementSystemException
|
|
* @throws UserRetrievalFault
|
|
* @throws GroupRetrievalFault
|
|
* @throws RoleRetrievalFault
|
|
*/
|
|
boolean removeRoleFromUser(long userId, long groupId, long roleId) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault,RoleRetrievalFault;
|
|
/**
|
|
*
|
|
* @param userId
|
|
* @param groupIds
|
|
* @return
|
|
* @throws UserManagementSystemException
|
|
* @throws UserRetrievalFault
|
|
* @throws GroupRetrievalFault
|
|
*/
|
|
boolean removeAllRolesFromUser(long userId, long... groupIds) throws UserManagementSystemException, UserRetrievalFault, GroupRetrievalFault;
|
|
|
|
/**
|
|
*
|
|
* @param roleId
|
|
* @param roleName
|
|
* @param roleDescription
|
|
* @return
|
|
*/
|
|
GCubeRole updateRole(long roleId, String roleName, String roleDescription) throws RoleRetrievalFault;
|
|
/**
|
|
*
|
|
* @param roleId
|
|
* @return
|
|
* @throws UserManagementSystemException
|
|
* @throws RoleRetrievalFault
|
|
*/
|
|
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
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
|
* @throws GroupRetrievalFault if the groupId does not exist
|
|
*/
|
|
GCubeRole getRole(String roleName, long groupId) throws RoleRetrievalFault, GroupRetrievalFault;
|
|
/**
|
|
*
|
|
* @param roleName
|
|
* @param groupId the LR groupId
|
|
* @return the LR RoleId if the roleName exists
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
|
* @throws GroupRetrievalFault if the groupId does not exist
|
|
*/
|
|
long getRoleId(String roleName, long groupId) throws RoleRetrievalFault, GroupRetrievalFault;
|
|
/**
|
|
*
|
|
* @param roleName
|
|
* @return the LR RoleId if the roleName exists
|
|
* @throws RoleRetrievalFault if the roleName does not exist
|
|
*/
|
|
long getRoleIdByName(String roleName) throws RoleRetrievalFault;
|
|
/**
|
|
*
|
|
* @return a list of {@link GcubeRole} independent from the roleType
|
|
*/
|
|
List<GCubeRole> listAllRoles();
|
|
/**
|
|
* @return a list of {@link GcubeRole} of type Site Role (Type=2)
|
|
*/
|
|
List<GCubeRole> listAllGroupRoles();
|
|
/**
|
|
*
|
|
* @param groupId
|
|
* @param userId
|
|
* @return a list of {@link GcubeRole} of type Site Role (Type=2)
|
|
* @throws GroupRetrievalFault
|
|
* @throws UserRetrievalFault
|
|
*/
|
|
List<GCubeRole> listRolesByUserAndGroup(long userId, long groupId) throws GroupRetrievalFault,UserRetrievalFault;
|
|
|
|
}
|