use of org.apache.cloudstack.api.response.ProjectRolePermissionResponse in project cloudstack by apache.
the class ListProjectRolePermissionsCmd method setupResponse.
private ProjectRolePermissionResponse setupResponse(ProjectRole role, ProjectRolePermission rolePermission) {
final ProjectRolePermissionResponse rolePermissionResponse = new ProjectRolePermissionResponse();
rolePermissionResponse.setProjectId(_projectService.getProject(rolePermission.getProjectId()).getUuid());
rolePermissionResponse.setProjectRoleId(role.getUuid());
rolePermissionResponse.setProjectRoleName(role.getName());
rolePermissionResponse.setId(rolePermission.getUuid());
rolePermissionResponse.setRule(rolePermission.getRule());
rolePermissionResponse.setRulePermission(rolePermission.getPermission());
rolePermissionResponse.setDescription(rolePermission.getDescription());
rolePermissionResponse.setObjectName("projectrolepermission");
return rolePermissionResponse;
}
use of org.apache.cloudstack.api.response.ProjectRolePermissionResponse in project cloudstack by apache.
the class ListProjectRolePermissionsCmd method execute.
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
List<ProjectRolePermission> projectRolePermissions = projRoleService.findAllProjectRolePermissions(getProjectId(), getProjectRoleId());
final ProjectRole projectRole = projRoleService.findProjectRole(getProjectRoleId(), getProjectId());
final ListResponse<ProjectRolePermissionResponse> response = new ListResponse<>();
final List<ProjectRolePermissionResponse> rolePermissionResponses = new ArrayList<>();
for (final ProjectRolePermission rolePermission : projectRolePermissions) {
ProjectRole role = projectRole;
if (role == null) {
role = projRoleService.findProjectRole(rolePermission.getProjectRoleId(), rolePermission.getProjectId());
}
rolePermissionResponses.add(setupResponse(role, rolePermission));
}
response.setResponses(rolePermissionResponses);
response.setResponseName(getCommandName());
setResponseObject(response);
}
use of org.apache.cloudstack.api.response.ProjectRolePermissionResponse in project cloudstack by apache.
the class CreateProjectRolePermissionCmd method setupResponse.
private void setupResponse(final ProjectRolePermission rolePermission, final ProjectRole role) {
final ProjectRolePermissionResponse response = new ProjectRolePermissionResponse();
response.setId(rolePermission.getUuid());
response.setProjectId(_projectService.getProject(rolePermission.getProjectId()).getUuid());
response.setProjectRoleId(role.getUuid());
response.setRule(rolePermission.getRule());
response.setRulePermission(rolePermission.getPermission());
response.setDescription(rolePermission.getDescription());
response.setResponseName(getCommandName());
response.setObjectName("projectrolepermission");
setResponseObject(response);
}
Aggregations