Search in sources :

Example 6 with ProjectRolePermission

use of org.apache.cloudstack.acl.ProjectRolePermission in project cloudstack by apache.

the class ProjectRolePermissionsDaoImpl method persist.

@Override
public ProjectRolePermissionVO persist(final ProjectRolePermissionVO item) {
    item.setSortOrder(0);
    final List<ProjectRolePermissionVO> permissionsList = findAllByRoleIdSorted(item.getProjectRoleId(), item.getProjectId());
    if (permissionsList != null && permissionsList.size() > 0) {
        ProjectRolePermission lastRule = permissionsList.get(permissionsList.size() - 1);
        item.setSortOrder(lastRule.getSortOrder() + 1);
    }
    return super.persist(item);
}
Also used : ProjectRolePermission(org.apache.cloudstack.acl.ProjectRolePermission) ProjectRolePermissionVO(org.apache.cloudstack.acl.ProjectRolePermissionVO)

Aggregations

ProjectRolePermission (org.apache.cloudstack.acl.ProjectRolePermission)6 ServerApiException (org.apache.cloudstack.api.ServerApiException)4 ProjectRole (org.apache.cloudstack.acl.ProjectRole)3 ArrayList (java.util.ArrayList)2 SuccessResponse (org.apache.cloudstack.api.response.SuccessResponse)2 ProjectRolePermissionVO (org.apache.cloudstack.acl.ProjectRolePermissionVO)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 ProjectRolePermissionResponse (org.apache.cloudstack.api.response.ProjectRolePermissionResponse)1