use of io.gravitee.am.management.handlers.management.api.model.RoleEntity in project gravitee-access-management by gravitee-io.
the class SystemRoleResource method convert.
private RoleEntity convert(Role role) {
RoleEntity roleEntity = new RoleEntity(role);
roleEntity.setAvailablePermissions(Permission.allPermissions(role.getAssignableType()).stream().map(permission -> permission.name().toLowerCase()).collect(Collectors.toList()));
roleEntity.setPermissions(Permission.flatten(role.getPermissionAcls()));
return roleEntity;
}
use of io.gravitee.am.management.handlers.management.api.model.RoleEntity in project gravitee-access-management by gravitee-io.
the class SystemRoleResourceTest method shouldGetSystemRole.
@Test
public void shouldGetSystemRole() {
final String roleId = "role-id";
final Role mockRole = new Role();
mockRole.setId(roleId);
mockRole.setName("role-name");
doReturn(Single.just(mockRole)).when(roleService).findById(ReferenceType.PLATFORM, Platform.DEFAULT, roleId);
final Response response = target("platform").path("roles").path(roleId).request().get();
assertEquals(HttpStatusCode.OK_200, response.getStatus());
final RoleEntity role = readEntity(response, RoleEntity.class);
assertEquals(roleId, role.getId());
}
use of io.gravitee.am.management.handlers.management.api.model.RoleEntity in project gravitee-access-management by gravitee-io.
the class RoleResource method convert.
/**
* Special converter that just fill permissions from Role.oauthScope attribute for compatibility with v2.
*/
private RoleEntity convert(Role role) {
RoleEntity roleEntity = new RoleEntity(role);
roleEntity.setPermissions(role.getOauthScopes());
return roleEntity;
}
use of io.gravitee.am.management.handlers.management.api.model.RoleEntity in project gravitee-access-management by gravitee-io.
the class RoleResource method convert.
private RoleEntity convert(Role role) {
RoleEntity roleEntity = new RoleEntity(role);
roleEntity.setAvailablePermissions(Permission.allPermissions(role.getAssignableType()).stream().map(permission -> permission.name().toLowerCase()).collect(Collectors.toList()));
roleEntity.setPermissions(Permission.flatten(role.getPermissionAcls()));
return roleEntity;
}
Aggregations