use of io.lumeer.api.model.common.Resource in project engine by Lumeer.
the class OrganizationCodec method generateIdIfAbsentFromDocument.
@Override
public Organization generateIdIfAbsentFromDocument(final Organization jsonOrganization) {
Resource resource = generateIdIfAbsentFromDocument((Resource) jsonOrganization);
jsonOrganization.setId(resource.getId());
return jsonOrganization;
}
use of io.lumeer.api.model.common.Resource in project engine by Lumeer.
the class PermissionsCheckerTest method testCheckGroupRole.
@Test
public void testCheckGroupRole() {
Resource resource = prepareResource(Collections.emptySet(), Collections.singleton(new Role(RoleType.Read)));
permissionsChecker.checkRole(resource, RoleType.Read);
}
use of io.lumeer.api.model.common.Resource in project engine by Lumeer.
the class PermissionsCheckerTest method testCheckUserRole.
@Test
public void testCheckUserRole() {
Resource resource = prepareResource(Collections.singleton(new Role(RoleType.Read)), Collections.emptySet());
permissionsChecker.checkRole(resource, RoleType.Read);
}
use of io.lumeer.api.model.common.Resource in project engine by Lumeer.
the class PermissionsCheckerTest method testGetActualRolesUserOnly.
@Test
public void testGetActualRolesUserOnly() {
Resource resource = prepareResource(Sets.newLinkedHashSet(new Role(RoleType.Read), new Role(RoleType.DataWrite)), Collections.emptySet());
Set<RoleType> roles = permissionsChecker.getActualRoles(resource);
assertThat(roles).containsOnly(RoleType.Read, RoleType.DataWrite);
}
use of io.lumeer.api.model.common.Resource in project engine by Lumeer.
the class PermissionsCheckerTest method testCheckNoRole.
@Test
public void testCheckNoRole() {
Resource resource = prepareResource(Collections.emptySet(), Collections.emptySet());
assertThatThrownBy(() -> permissionsChecker.checkRole(resource, RoleType.Read)).isInstanceOf(NoResourcePermissionException.class).hasFieldOrPropertyWithValue("resource", resource);
}
Aggregations