use of io.lumeer.storage.api.exception.ResourceNotFoundException in project engine by Lumeer.
the class CollectionFacade method checkProjectWriteRole.
private void checkProjectWriteRole() {
if (!workspaceKeeper.getProject().isPresent()) {
throw new ResourceNotFoundException(ResourceType.PROJECT);
}
Project project = workspaceKeeper.getProject().get();
permissionsChecker.checkRole(project, Role.WRITE);
}
use of io.lumeer.storage.api.exception.ResourceNotFoundException in project engine by Lumeer.
the class GroupFacade method checkPermissions.
private void checkPermissions() {
if (!workspaceKeeper.getOrganization().isPresent()) {
throw new ResourceNotFoundException(ResourceType.ORGANIZATION);
}
Organization organization = workspaceKeeper.getOrganization().get();
permissionsChecker.checkRole(organization, Role.MANAGE);
}
use of io.lumeer.storage.api.exception.ResourceNotFoundException in project engine by Lumeer.
the class AuthenticatedUser method getCurrentUserGroups.
public Set<String> getCurrentUserGroups() {
Optional<Organization> organizationOptional = workspaceKeeper.getOrganization();
if (!organizationOptional.isPresent()) {
throw new ResourceNotFoundException(ResourceType.ORGANIZATION);
}
Organization organization = organizationOptional.get();
Map<String, Set<String>> userGroups = userCache.getUser(getCurrentUsername()).getGroups();
return userGroups != null && userGroups.containsKey(organization.getId()) ? userGroups.get(organization.getId()) : Collections.emptySet();
}
use of io.lumeer.storage.api.exception.ResourceNotFoundException in project engine by Lumeer.
the class ProjectFacade method checkOrganizationWriteRole.
private void checkOrganizationWriteRole() {
if (!workspaceKeeper.getOrganization().isPresent()) {
throw new ResourceNotFoundException(ResourceType.ORGANIZATION);
}
Organization organization = workspaceKeeper.getOrganization().get();
permissionsChecker.checkRole(organization, Role.WRITE);
}
use of io.lumeer.storage.api.exception.ResourceNotFoundException in project engine by Lumeer.
the class GroupFacade method deleteGroupFromUsers.
private void deleteGroupFromUsers(String groupId) {
if (!workspaceKeeper.getOrganization().isPresent()) {
throw new ResourceNotFoundException(ResourceType.ORGANIZATION);
}
Organization organization = workspaceKeeper.getOrganization().get();
userDao.deleteGroupFromUsers(organization.getId(), groupId);
}
Aggregations