Project

General

Profile

« Previous | Next » 

Revision 60486

latest and gratest from trunk

View differences:

AuthorizationService.java
6 6
public class AuthorizationService {
7 7

  
8 8
    public final String PORTAL_ADMIN = "PORTAL_ADMINISTRATOR";
9
    public final String ANONYMOUS_USER = "ROLE_ANONYMOUS";
10
    public final String REGISTERED_USER = "REGISTERED_USER";
9 11

  
10
    private String mapType(String type) {
12
    private String mapType(String type, boolean communityMap) {
11 13
        if(type.equals("organization")) {
12 14
            type = "institution";
13
        }
14
        if(type.equals("ri")) {
15
        } else if(type.equals("ri") && communityMap) {
15 16
            type = "community";
16 17
        }
17 18
        return type;
......
22 23
     *
23 24
     * */
24 25
    public String curator(String type) {
25
        return "CURATOR_" + mapType(type).toUpperCase();
26
        return "CURATOR_" + mapType(type, true).toUpperCase();
26 27
    }
27 28

  
28 29
    /**
......
31 32
     * Id = EE, EGI, etc
32 33
     * */
33 34
    public String manager(String type, String id) {
34
        return mapType(type).toUpperCase() + "_" + id.toUpperCase() + "_MANAGER";
35
        return mapType(type, true).toUpperCase() + "_" + id.toUpperCase() + "_MANAGER";
35 36
    }
36 37

  
37 38
    /**
38
     * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT
39
     * Type = FUNDER | COMMUNITY | RI | INSTITUTION | PROJECT
39 40
     *
40 41
     * Id = EE, EGI, etc
41 42
     * */
42 43
    public String member(String type, String id) {
43
        return mapType(type).toUpperCase() + "_" + id.toUpperCase();
44
        return mapType(type, false).toUpperCase() + "_" + id.toUpperCase();
44 45
    }
45 46

  
46 47
    public boolean isCommunity(String type) {
47
        return mapType(type).equals("community");
48
        return mapType(type, false).equals("community");
48 49
    }
49 50
}

Also available in: Unified diff