use of org.apache.nifi.registry.authorization.Permissions in project nifi by apache.
the class StandardNiFiServiceFacade method updateRemoteProcessGroup.
@Override
public RemoteProcessGroupEntity updateRemoteProcessGroup(final Revision revision, final RemoteProcessGroupDTO remoteProcessGroupDTO) {
final RemoteProcessGroup remoteProcessGroupNode = remoteProcessGroupDAO.getRemoteProcessGroup(remoteProcessGroupDTO.getId());
final RevisionUpdate<RemoteProcessGroupDTO> snapshot = updateComponent(revision, remoteProcessGroupNode, () -> remoteProcessGroupDAO.updateRemoteProcessGroup(remoteProcessGroupDTO), remoteProcessGroup -> dtoFactory.createRemoteProcessGroupDto(remoteProcessGroup));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(remoteProcessGroupNode);
final RevisionDTO updateRevision = dtoFactory.createRevisionDTO(snapshot.getLastModification());
final RemoteProcessGroupStatusDTO status = dtoFactory.createRemoteProcessGroupStatusDto(controllerFacade.getRemoteProcessGroupStatus(remoteProcessGroupNode.getIdentifier()));
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(remoteProcessGroupNode.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createRemoteProcessGroupEntity(snapshot.getComponent(), updateRevision, permissions, status, bulletinEntities);
}
use of org.apache.nifi.registry.authorization.Permissions in project nifi by apache.
the class StandardNiFiServiceFacade method createReportingTaskEntity.
private ReportingTaskEntity createReportingTaskEntity(final ReportingTaskNode reportingTask) {
final RevisionDTO revision = dtoFactory.createRevisionDTO(revisionManager.getRevision(reportingTask.getIdentifier()));
final PermissionsDTO permissions = dtoFactory.createPermissionsDto(reportingTask);
final List<BulletinDTO> bulletins = dtoFactory.createBulletinDtos(bulletinRepository.findBulletinsForSource(reportingTask.getIdentifier()));
final List<BulletinEntity> bulletinEntities = bulletins.stream().map(bulletin -> entityFactory.createBulletinEntity(bulletin, permissions.getCanRead())).collect(Collectors.toList());
return entityFactory.createReportingTaskEntity(dtoFactory.createReportingTaskDto(reportingTask), revision, permissions, bulletinEntities);
}
use of org.apache.nifi.registry.authorization.Permissions in project nifi-registry by apache.
the class AuthorizationService method getTopLevelPermissions.
private ResourcePermissions getTopLevelPermissions(String tenantIdentifier) {
ResourcePermissions resourcePermissions = new ResourcePermissions();
final Permissions bucketsPermissions = getPermissionsForResource(tenantIdentifier, ResourceFactory.getBucketsResource());
resourcePermissions.setBuckets(bucketsPermissions);
final Permissions policiesPermissions = getPermissionsForResource(tenantIdentifier, ResourceFactory.getPoliciesResource());
resourcePermissions.setPolicies(policiesPermissions);
final Permissions tenantsPermissions = getPermissionsForResource(tenantIdentifier, ResourceFactory.getTenantsResource());
resourcePermissions.setTenants(tenantsPermissions);
final Permissions proxyPermissions = getPermissionsForResource(tenantIdentifier, ResourceFactory.getProxyResource());
resourcePermissions.setProxy(proxyPermissions);
return resourcePermissions;
}
use of org.apache.nifi.registry.authorization.Permissions in project nifi-registry by apache.
the class AuthorizationService method getTopLevelPermissions.
private ResourcePermissions getTopLevelPermissions() {
NiFiUser user = NiFiUserUtils.getNiFiUser();
ResourcePermissions resourcePermissions = new ResourcePermissions();
final Permissions bucketsPermissions = getPermissionsForResource(authorizableLookup.getBucketsAuthorizable());
resourcePermissions.setBuckets(bucketsPermissions);
final Permissions policiesPermissions = getPermissionsForResource(authorizableLookup.getPoliciesAuthorizable());
resourcePermissions.setPolicies(policiesPermissions);
final Permissions tenantsPermissions = getPermissionsForResource(authorizableLookup.getTenantsAuthorizable());
resourcePermissions.setTenants(tenantsPermissions);
final Permissions proxyPermissions = getPermissionsForResource(authorizableLookup.getProxyAuthorizable());
resourcePermissions.setProxy(proxyPermissions);
return resourcePermissions;
}
use of org.apache.nifi.registry.authorization.Permissions in project nifi-registry by apache.
the class PermissionsService method populateBucketPermissions.
private void populateBucketPermissions(final Bucket bucket, final Permissions knownPermissions) {
if (bucket == null) {
return;
}
Permissions bucketPermissions = createPermissionsForBucketId(bucket.getIdentifier(), knownPermissions);
bucket.setPermissions(bucketPermissions);
}
Aggregations