use of com.epam.pipeline.entity.security.acl.AclSid in project cloud-pipeline by epam.
the class PermissionsContainer method add.
public void add(final Collection<AclPermissionEntry> permissions, final String owner) {
allowedUsers.add(owner);
if (CollectionUtils.isEmpty(permissions)) {
return;
}
permissions.forEach(aclPermissionEntry -> {
final AclSid sid = aclPermissionEntry.getSid();
final String sidName = sid.getName();
final Set<String> allowed = sid.isPrincipal() ? allowedUsers : allowedGroups;
final Set<String> denied = sid.isPrincipal() ? deniedUsers : deniedGroups;
addPermissions(aclPermissionEntry.getMask(), sidName, owner, allowed, denied);
});
}
use of com.epam.pipeline.entity.security.acl.AclSid in project cloud-pipeline by epam.
the class GrantPermissionManager method getEntityPermission.
private EntityPermission getEntityPermission(Map<AbstractSecuredEntity, List<AclPermissionEntry>> allPermissions, AbstractSecuredEntity entity) {
AbstractSecuredEntity aclEntity = getAclEntity(entity);
Map<AclSid, Integer> mergedPermissions = getEntityPermissions(aclEntity, allPermissions);
mergeWithParentPermissions(mergedPermissions, entity.getParent(), allPermissions);
Set<AclPermissionEntry> merged = buildAclPermissionEntries(mergedPermissions);
// clear parent, not to return full hierarchy
entity.clearParent();
EntityPermission entityPermission = new EntityPermission();
entityPermission.setEntity(entity);
entityPermission.setPermissions(merged);
return entityPermission;
}
use of com.epam.pipeline.entity.security.acl.AclSid in project cloud-pipeline by epam.
the class GrantPermissionManager method convertAclToEntryForUser.
private AclSecuredEntry convertAclToEntryForUser(AbstractSecuredEntity entity, MutableAcl acl, Sid sid) {
AclSid aclSid = new AclSid(sid);
AclSecuredEntry entry = convertAclToEntry(entity, acl);
List<AclPermissionEntry> filteredPermissions = entry.getPermissions().stream().filter(p -> p.getSid().equals(aclSid)).collect(toList());
entry.setPermissions(filteredPermissions);
return entry;
}
Aggregations