use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.RoleAliasDTO in project carbon-apimgt by wso2.
the class SystemScopesMappingUtil method fromRoleAliasObjectToRoleAliasDTOList.
/**
* Converts api scope-role mapping to RoleScopeDTO List.
*
* @param roleMapping Map of a Role Scope Mapping
* @return RoleScopeDTO list
*/
private static List<RoleAliasDTO> fromRoleAliasObjectToRoleAliasDTOList(Map<String, List<String>> roleMapping) {
List<RoleAliasDTO> roleAliasDTOS = new ArrayList<>(roleMapping.size());
for (Map.Entry<String, List<String>> mapping : roleMapping.entrySet()) {
RoleAliasDTO roleAliasDTO = new RoleAliasDTO();
roleAliasDTO.setRole(mapping.getKey());
roleAliasDTO.setAliases(mapping.getValue());
roleAliasDTOS.add(roleAliasDTO);
}
return roleAliasDTOS;
}
use of org.wso2.carbon.apimgt.rest.api.admin.v1.dto.RoleAliasDTO in project carbon-apimgt by wso2.
the class SystemScopesMappingUtil method createJsonObjectOfRoleMapping.
/**
* Extract roles and aliases and create JSONObject
*
* @param body RoleAliasListDTO as request body
* @return JSONObject role-alias data
*/
public static JSONObject createJsonObjectOfRoleMapping(RoleAliasListDTO body) {
JSONObject roleJson = new JSONObject();
for (RoleAliasDTO roleAlias : body.getList()) {
String aliases = roleAlias.getAliases().toString().replaceAll("\\[", "").replaceAll("\\]", "");
roleJson.put(roleAlias.getRole(), aliases);
}
return roleJson;
}
Aggregations