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.List;
7

    
8
public interface AuthorizationService {
9

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

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

    
23

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

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

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