1
|
package eu.dnetlib.openaire.usermanagement.utils;
|
2
|
|
3
|
import org.springframework.stereotype.Component;
|
4
|
|
5
|
@Component("AuthorizationService")
|
6
|
public class AuthorizationService {
|
7
|
|
8
|
public final String SUPER_ADMIN = "SUPER_ADMINISTRATOR";
|
9
|
public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR";
|
10
|
public final String USER_ADMIN = "USER_MANAGER";
|
11
|
|
12
|
/**
|
13
|
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT
|
14
|
*
|
15
|
* */
|
16
|
public String curator(String type) {
|
17
|
return type.toUpperCase() + "_CURATOR";
|
18
|
}
|
19
|
|
20
|
/**
|
21
|
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT
|
22
|
*
|
23
|
* Id = EE, EGI, etc
|
24
|
* */
|
25
|
public String manager(String type, String id) {
|
26
|
return type.toUpperCase() + "_" + id.toUpperCase() + "_MANAGER";
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT
|
31
|
*
|
32
|
* Id = EE, EGI, etc
|
33
|
* */
|
34
|
public String member(String type, String id) {
|
35
|
return type.toUpperCase() + "_" + id.toUpperCase();
|
36
|
}
|
37
|
|
38
|
public boolean isCommunity(String type) {
|
39
|
return type.equals("community");
|
40
|
}
|
41
|
}
|