diff --git a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/security/AuthorizationService.java b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/security/AuthorizationService.java index 631488a..41664b2 100644 --- a/src/main/java/eu/dnetlib/uoaauthorizationlibrary/security/AuthorizationService.java +++ b/src/main/java/eu/dnetlib/uoaauthorizationlibrary/security/AuthorizationService.java @@ -19,11 +19,10 @@ public class AuthorizationService { public final String REGISTERED_USER = "REGISTERED_USER"; - private String mapType(String type) { - if(type.equals("organization")) { + private String mapType(String type, boolean communityMap) { + if (type.equals("organization")) { type = "institution"; - } - if(type.equals("ri")) { + } else if (type.equals("ri") && communityMap) { type = "community"; } return type; @@ -31,35 +30,34 @@ public class AuthorizationService { /** * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT - * - * */ + */ public String curator(String type) { - return "CURATOR_"+mapType(type).toUpperCase(); + return "CURATOR_" + mapType(type, true).toUpperCase(); } /** * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT - * + *
* Id = EE, EGI, etc - * */ + */ public String manager(String type, String id) { - return mapType(type).toUpperCase() + "_" + id.toUpperCase() + "_MANAGER"; + return mapType(type, true).toUpperCase() + "_" + id.toUpperCase() + "_MANAGER"; } /** - * Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT - * + * Type = FUNDER | COMMUNITY | RI | INSTITUTION | PROJECT + *
* Id = EE, EGI, etc
- * */
+ */
public String member(String type, String id) {
- return mapType(type).toUpperCase() + "_" + id.toUpperCase();
+ return mapType(type, false).toUpperCase() + "_" + id.toUpperCase();
}
public List