Add regex condition for roles to replace '.' with '_' e.g beta.datasource

This commit is contained in:
Konstantinos Triantafyllou 2021-09-09 19:54:31 +03:00
parent 9b3d6f2fbb
commit 0bf6ba9fa6
1 changed files with 4 additions and 4 deletions

View File

@ -10,11 +10,11 @@ public class AuthoritiesUtils {
* Type = FUNDER | COMMUNITY | INSTITUTION | PROJECT etc.
*/
public static String curator(String type) {
return "CURATOR_" + type.toUpperCase();
return "CURATOR_" + type.replaceAll("[.]", "_").toUpperCase();
}
public static String curatorRole(String type) {
return "Curator - " + Character.toString(type.charAt(0)).toUpperCase() + type.substring(1);
return "Curator - " + Character.toString(type.replaceAll("[.]", "_").charAt(0)).toUpperCase() + type.substring(1);
}
/**
@ -23,7 +23,7 @@ public class AuthoritiesUtils {
* Id = EE, EGI, etc
*/
public static String manager(String type, String id) {
return type.toUpperCase() + "_" + id.toUpperCase() + "_MANAGER";
return type.replaceAll("[.]", "_").toUpperCase() + "_" + id.toUpperCase() + "_MANAGER";
}
/**
@ -32,7 +32,7 @@ public class AuthoritiesUtils {
* Id = EE, EGI, etc
*/
public static String member(String type, String id) {
return type.toUpperCase() + "_" + id.toUpperCase();
return type.replaceAll("[.]", "_").toUpperCase() + "_" + id.toUpperCase();
}
public static String memberRole(String type, String id) {