Project

General

Profile

1
package eu.dnetlib.repo.manager.service.security;
2

    
3
import eu.dnetlib.repo.manager.domain.dto.User;
4
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
5

    
6
import java.util.Collection;
7
import java.util.List;
8

    
9
public interface AuthorizationService {
10

    
11
    /**
12
     * @param type
13
     * @param id
14
     * @return
15
     */
16
    String member(String type, String id); //TODO: use or delete
17

    
18
    /**
19
     * @param id Resource Id to check.
20
     * @return Checks if a user is a member of a resource.
21
     */
22
    boolean isMemberOf(String id);
23

    
24

    
25
    /**
26
     * Returns a list of admins of the resource.
27
     *
28
     * @param repoId
29
     * @return
30
     */
31
    List<User> getAdminsOfRepo(String repoId);
32

    
33
    /**
34
     * Add a user as admin to a resource.
35
     *
36
     * @param id    Resource id
37
     * @param email User email
38
     * @return
39
     * @throws ResourceNotFoundException
40
     */
41
    boolean addAdmin(String id, String email) throws ResourceNotFoundException;
42

    
43
    /**
44
     * Remove user from resource admins.
45
     *
46
     * @param id    Resource id
47
     * @param email User email
48
     * @return
49
     * @throws ResourceNotFoundException
50
     */
51
    boolean removeAdmin(String id, String email) throws ResourceNotFoundException;
52

    
53

    
54
    /**
55
     * Returns the roles of the authenticated user.
56
     * 
57
     * @return
58
     */
59
    Collection<String> getUserRoles();
60

    
61
    /**
62
     * Returns the roles of the user with the given email.
63
     *
64
     * @param email
65
     * @return
66
     */
67
    Collection<String> getUserRoles(String email);
68

    
69
}
(4-4/6)