1 |
61319
|
spyroukon
|
package eu.dnetlib.repo.manager.service.security;
|
2 |
|
|
|
3 |
61363
|
spyroukon
|
import eu.dnetlib.repo.manager.domain.dto.User;
|
4 |
|
|
import eu.dnetlib.repo.manager.exception.ResourceNotFoundException;
|
5 |
|
|
|
6 |
61372
|
spyroukon
|
import java.util.Collection;
|
7 |
61363
|
spyroukon
|
import java.util.List;
|
8 |
|
|
|
9 |
61319
|
spyroukon
|
public interface AuthorizationService {
|
10 |
|
|
|
11 |
|
|
/**
|
12 |
|
|
* @param type
|
13 |
|
|
* @param id
|
14 |
|
|
* @return
|
15 |
|
|
*/
|
16 |
61363
|
spyroukon
|
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 |
61372
|
spyroukon
|
|
53 |
|
|
|
54 |
61373
|
spyroukon
|
/**
|
55 |
|
|
* Returns the roles of the authenticated user.
|
56 |
|
|
*
|
57 |
|
|
* @return
|
58 |
|
|
*/
|
59 |
61372
|
spyroukon
|
Collection<String> getUserRoles();
|
60 |
|
|
|
61 |
61373
|
spyroukon
|
/**
|
62 |
|
|
* Returns the roles of the user with the given email.
|
63 |
|
|
*
|
64 |
|
|
* @param email
|
65 |
|
|
* @return
|
66 |
|
|
*/
|
67 |
61372
|
spyroukon
|
Collection<String> getUserRoles(String email);
|
68 |
|
|
|
69 |
61319
|
spyroukon
|
}
|