use of io.lumeer.core.adapter.PermissionAdapter in project engine by Lumeer.
the class AuditFacade method init.
@PostConstruct
public void init() {
constraintManager = ConstraintManager.getInstance(configurationProducer);
pusherClient = pusherHelperFacade.getPusherClient();
auditAdapter = new AuditAdapter(auditDao);
documentAdapter = new DocumentAdapter(resourceCommentDao, favoriteItemDao);
linkInstanceAdapter = new LinkInstanceAdapter(resourceCommentDao);
PermissionAdapter permissionAdapter = new PermissionAdapter(userDao, groupDao, viewDao, linkTypeDao, collectionDao);
resourceAdapter = new ResourceAdapter(permissionAdapter, collectionDao, linkTypeDao, viewDao, userDao);
collectionAdapter = new CollectionAdapter(collectionDao, favoriteItemDao, documentDao);
linkTypeAdapter = new LinkTypeAdapter(linkTypeDao, linkInstanceDao);
pusherAdapter = new PusherAdapter(requestDataKeeper.getAppId(), getFacadeAdapter(), resourceAdapter, permissionAdapter, viewDao, linkTypeDao, collectionDao);
}
use of io.lumeer.core.adapter.PermissionAdapter in project engine by Lumeer.
the class AbstractContextualTask method initialize.
@Override
public ContextualTask initialize(final User initiator, final DaoContextSnapshot daoContextSnapshot, final PusherClient pusherClient, final LumeerS3Client lumeerS3Client, final RequestDataKeeper requestDataKeeper, final ConstraintManager constraintManager, DefaultConfigurationProducer.DeployEnvironment environment, final int recursionDepth) {
this.initiator = initiator;
this.daoContextSnapshot = daoContextSnapshot;
this.pusherClient = pusherClient;
this.lumeerS3Client = lumeerS3Client;
this.requestDataKeeper = requestDataKeeper;
this.constraintManager = constraintManager;
this.environment = environment;
this.timeZone = requestDataKeeper.getTimezone();
this.recursionDepth = recursionDepth;
collectionAdapter = new CollectionAdapter(daoContextSnapshot.getCollectionDao(), daoContextSnapshot.getFavoriteItemDao(), daoContextSnapshot.getDocumentDao());
permissionAdapter = new PermissionAdapter(daoContextSnapshot.getUserDao(), daoContextSnapshot.getGroupDao(), daoContextSnapshot.getViewDao(), daoContextSnapshot.getLinkTypeDao(), daoContextSnapshot.getCollectionDao());
resourceAdapter = new ResourceAdapter(permissionAdapter, daoContextSnapshot.getCollectionDao(), daoContextSnapshot.getLinkTypeDao(), daoContextSnapshot.getViewDao(), daoContextSnapshot.getUserDao());
viewAdapter = new ViewAdapter(resourceAdapter, daoContextSnapshot.getFavoriteItemDao());
documentAdapter = new DocumentAdapter(daoContextSnapshot.getResourceCommentDao(), daoContextSnapshot.getFavoriteItemDao());
linkTypeAdapter = new LinkTypeAdapter(daoContextSnapshot.getLinkTypeDao(), daoContextSnapshot.getLinkInstanceDao());
linkInstanceAdapter = new LinkInstanceAdapter(daoContextSnapshot.getResourceCommentDao());
pusherAdapter = new PusherAdapter(getAppId(), new FacadeAdapter(permissionAdapter), resourceAdapter, permissionAdapter, daoContextSnapshot.getViewDao(), daoContextSnapshot.getLinkTypeDao(), daoContextSnapshot.getCollectionDao());
fileAttachmentAdapter = new FileAttachmentAdapter(getLumeerS3Client(), daoContextSnapshot.getFileAttachmentDao(), environment.name());
return this;
}
use of io.lumeer.core.adapter.PermissionAdapter in project engine by Lumeer.
the class PermissionsChecker method init.
@PostConstruct
public void init() {
collectionAdapter = new CollectionAdapter(collectionDao, favoriteItemDao, documentDao);
permissionAdapter = new PermissionAdapter(userDao, groupDao, viewDao, linkTypeDao, collectionDao);
}
use of io.lumeer.core.adapter.PermissionAdapter in project engine by Lumeer.
the class DelayedActionProcessor method checkActionResourceExistsAndFillData.
private Collection checkActionResourceExistsAndFillData(final DelayedAction action, final User receiver) {
final String organizationId = action.getData().getString(DelayedAction.DATA_ORGANIZATION_ID);
final String projectId = action.getData().getString(DelayedAction.DATA_PROJECT_ID);
final String collectionId = action.getData().getString(DelayedAction.DATA_COLLECTION_ID);
final String documentId = action.getData().getString(DelayedAction.DATA_DOCUMENT_ID);
try {
if (organizationId != null) {
final DataStorage userDataStorage = getDataStorage(organizationId);
final Organization organization = organizations.computeIfAbsent(organizationId, id -> organizationDao.getOrganizationById(organizationId));
action.getData().append(DelayedAction.DATA_ORGANIZATION_NAME, organization.getName());
action.getData().append(DelayedAction.DATA_ORGANIZATION_CODE, organization.getCode());
action.getData().append(DelayedAction.DATA_ORGANIZATION_ICON, organization.getIcon());
action.getData().append(DelayedAction.DATA_ORGANIZATION_COLOR, organization.getColor());
final DaoContextSnapshot organizationDaoSnapshot = organizationDaoSnapshots.computeIfAbsent(organizationId, id -> getDaoContextSnapshot(userDataStorage, new Workspace(organization, null)));
if (projectId != null) {
final Project project = projects.computeIfAbsent(projectId, id -> organizationDaoSnapshot.getProjectDao().getProjectById(projectId));
action.getData().append(DelayedAction.DATA_PROJECT_NAME, project.getName());
action.getData().append(DelayedAction.DATA_PROJECT_CODE, project.getCode());
action.getData().append(DelayedAction.DATA_PROJECT_ICON, project.getIcon());
action.getData().append(DelayedAction.DATA_PROJECT_COLOR, project.getColor());
final String projectKey = organizationId + ":" + projectId;
final DaoContextSnapshot projectDaoSnapshot = projectDaoSnapshots.computeIfAbsent(projectKey, key -> getDaoContextSnapshot(userDataStorage, new Workspace(organization, project)));
final PermissionAdapter permissionAdapter = permissionAdapters.computeIfAbsent(projectKey, key -> new PermissionAdapter(projectDaoSnapshot.getUserDao(), projectDaoSnapshot.getGroupDao(), projectDaoSnapshot.getViewDao(), projectDaoSnapshot.getLinkTypeDao(), projectDaoSnapshot.getCollectionDao()));
if (receiver != null && !permissionAdapter.canReadWorkspace(organization, project, receiver.getId())) {
return null;
}
if (collectionId != null) {
final Collection collection = collections.computeIfAbsent(collectionId, id -> projectDaoSnapshot.getCollectionDao().getCollectionById(collectionId));
action.getData().append(DelayedAction.DATA_COLLECTION_NAME, collection.getName());
action.getData().append(DelayedAction.DATA_COLLECTION_ICON, collection.getIcon());
action.getData().append(DelayedAction.DATA_COLLECTION_COLOR, collection.getColor());
if (documentId != null) {
final Document document = projectDaoSnapshot.getDocumentDao().getDocumentById(documentId);
document.setData(projectDaoSnapshot.getDataDao().getData(collectionId, documentId));
if (receiver != null && !permissionAdapter.canReadDocument(organization, project, document, collection, receiver.getId())) {
return null;
}
return collection;
}
}
}
}
} catch (ResourceNotFoundException e) {
return null;
}
return null;
}
Aggregations