use of org.apache.cloudstack.api.response.RolePermissionResponse in project cloudstack by apache.
the class CreateRolePermissionCmd method setupResponse.
private void setupResponse(final RolePermission rolePermission, final Role role) {
final RolePermissionResponse response = new RolePermissionResponse();
response.setId(rolePermission.getUuid());
response.setRoleId(role.getUuid());
response.setRule(rolePermission.getRule());
response.setRulePermission(rolePermission.getPermission());
response.setDescription(rolePermission.getDescription());
response.setResponseName(getCommandName());
response.setObjectName("rolepermission");
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.RolePermissionResponse in project cloudstack by apache.
the class ListRolePermissionsCmd method setupResponse.
private void setupResponse(final List<RolePermission> rolePermissions, final Long roleId) {
final Role roleProvided = roleService.findRole(roleId);
final ListResponse<RolePermissionResponse> response = new ListResponse<>();
final List<RolePermissionResponse> rolePermissionResponses = new ArrayList<>();
for (final RolePermission rolePermission : rolePermissions) {
final RolePermissionResponse rolePermissionResponse = new RolePermissionResponse();
Role role = roleProvided;
if (role == null) {
role = roleService.findRole(rolePermission.getRoleId());
}
rolePermissionResponse.setRoleId(role.getUuid());
rolePermissionResponse.setRoleName(role.getName());
rolePermissionResponse.setId(rolePermission.getUuid());
rolePermissionResponse.setRule(rolePermission.getRule());
rolePermissionResponse.setRulePermission(rolePermission.getPermission());
rolePermissionResponse.setDescription(rolePermission.getDescription());
rolePermissionResponse.setObjectName("rolepermission");
rolePermissionResponses.add(rolePermissionResponse);
}
response.setResponses(rolePermissionResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
Aggregations