use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationFacade method removeUserPermission.
public void removeUserPermission(final String organizationCode, final String user) {
Organization organization = checkRoleAndGetOrganization(organizationCode, Role.MANAGE);
organization.getPermissions().removeUserPermission(user);
organizationDao.updateOrganization(organization.getId(), organization);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationFacade method getOrganization.
public Organization getOrganization(final String organizationCode) {
Organization organization = organizationDao.getOrganizationByCode(organizationCode);
permissionsChecker.checkRole(organization, Role.READ);
return keepOnlyActualUserRoles(organization);
}
use of io.lumeer.api.model.Organization in project engine by Lumeer.
the class OrganizationFacade method updateOrganization.
public Organization updateOrganization(final String organizationCode, final Organization organization) {
Organization storedOrganization = organizationDao.getOrganizationByCode(organizationCode);
permissionsChecker.checkRole(storedOrganization, Role.MANAGE);
keepStoredPermissions(organization, storedOrganization.getPermissions());
Organization updatedOrganization = organizationDao.updateOrganization(storedOrganization.getId(), organization);
return keepOnlyActualUserRoles(updatedOrganization);
}
use of io.lumeer.api.model.Organization 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.api.model.Organization 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