use of com.epam.pipeline.entity.security.acl.AclClass in project cloud-pipeline by epam.
the class IssueManager method validateEntityParameters.
private void validateEntityParameters(EntityVO entityVO) {
Assert.notNull(entityVO, messageHelper.getMessage(MessageConstants.ERROR_INVALID_ISSUE_ENTITY_PARAMETERS));
Long entityId = entityVO.getEntityId();
AclClass entityClass = entityVO.getEntityClass();
Assert.notNull(entityId, messageHelper.getMessage(MessageConstants.ERROR_INVALID_ISSUE_ENTITY_ID));
Assert.notNull(entityClass, messageHelper.getMessage(MessageConstants.ERROR_INVALID_ISSUE_ENTITY_CLASS));
}
use of com.epam.pipeline.entity.security.acl.AclClass in project cloud-pipeline by epam.
the class GrantPermissionManager method loadAllEntitiesPermissions.
public EntityWithPermissionVO loadAllEntitiesPermissions(AclClass aclClass, Integer page, Integer pageSize, boolean expandGroups, Integer filterMask) {
EntityWithPermissionVO result = new EntityWithPermissionVO();
Collection<? extends AbstractSecuredEntity> entities = entityManager.loadAllWithParents(aclClass, page, pageSize);
Map<AbstractSecuredEntity, List<AclPermissionEntry>> allPermissions = getEntitiesPermissions(entities);
result.setTotalCount(entityManager.loadTotalCount(aclClass));
List<EntityPermission> permissions = entities.stream().distinct().sorted(Comparator.comparingLong(BaseEntity::getId)).map(entity -> getEntityPermission(allPermissions, entity)).collect(toList());
if (expandGroups) {
expandGroups(permissions);
if (filterMask != null) {
permissions.forEach(entry -> {
Set<AclPermissionEntry> filtered = SetUtils.emptyIfNull(entry.getPermissions()).stream().filter(permission -> permissionsService.isMaskBitSet(permission.getMask(), filterMask)).collect(toSet());
entry.setPermissions(filtered);
});
}
}
result.setEntityPermissions(permissions);
return result;
}
Aggregations