75 lines
1.7 KiB
Java
75 lines
1.7 KiB
Java
package eu.dnetlib.repo.manager.service.security;
|
|
|
|
import eu.dnetlib.repo.manager.domain.dto.User;
|
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
public interface AuthorizationService {
|
|
|
|
/**
|
|
* @param type
|
|
* @param id
|
|
* @return
|
|
*/
|
|
String member(String type, String id); //TODO: use or delete
|
|
|
|
/**
|
|
* @param id Resource Id to check.
|
|
* @return Checks if a user is a member of a resource.
|
|
*/
|
|
boolean isMemberOf(String id);
|
|
|
|
/**
|
|
* @param id repository interface Id to check.
|
|
* @return Checks if a user is a member of a repository interface.
|
|
*/
|
|
boolean isMemberOfInterface(String id);
|
|
|
|
/**
|
|
* Returns a list of admins of the resource.
|
|
*
|
|
* @param repoId
|
|
* @return
|
|
*/
|
|
List<User> getAdminsOfRepo(String repoId);
|
|
|
|
/**
|
|
* Add a user as admin to a resource.
|
|
*
|
|
* @param id Resource id
|
|
* @param email User email
|
|
* @return
|
|
* @throws ResourceNotFoundException
|
|
*/
|
|
boolean addAdmin(String id, String email) throws ResourceNotFoundException;
|
|
|
|
/**
|
|
* Remove user from resource admins.
|
|
*
|
|
* @param id Resource id
|
|
* @param email User email
|
|
* @return
|
|
* @throws ResourceNotFoundException
|
|
*/
|
|
boolean removeAdmin(String id, String email) throws ResourceNotFoundException;
|
|
|
|
|
|
/**
|
|
* Returns the roles of the authenticated user.
|
|
*
|
|
* @return
|
|
*/
|
|
Collection<String> getUserRoles();
|
|
|
|
/**
|
|
* Returns the roles of the user with the given email.
|
|
*
|
|
* @param email
|
|
* @return
|
|
*/
|
|
Collection<String> getUserRoles(String email);
|
|
|
|
}
|