use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class PermissionsCheckerTest method prepareResource.
private Resource prepareResource(Set<Role> userRoles, Set<Role> groupRoles) {
Permission userPermission = Mockito.mock(Permission.class);
Mockito.when(userPermission.getName()).thenReturn(USER);
Mockito.when(userPermission.getRoles()).thenReturn(userRoles);
Permission groupPermission = Mockito.mock(Permission.class);
Mockito.when(groupPermission.getName()).thenReturn(GROUP);
Mockito.when(groupPermission.getRoles()).thenReturn(groupRoles);
Permissions permissions = Mockito.mock(Permissions.class);
Mockito.when(permissions.getUserPermissions()).thenReturn(Collections.singleton(userPermission));
Mockito.when(permissions.getGroupPermissions()).thenReturn(Collections.singleton(groupPermission));
Resource resource = Mockito.mock(Resource.class);
Mockito.when(resource.getPermissions()).thenReturn(permissions);
Mockito.when(resource.getType()).thenReturn(ResourceType.PROJECT);
return resource;
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class CollectionFacadeIT method testRemoveUserPermission.
@Test
public void testRemoveUserPermission() {
String collectionId = createCollection(CODE).getId();
collectionFacade.removeUserPermission(collectionId, USER);
Permissions permissions = collectionDao.getCollectionByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertThat(permissions.getUserPermissions()).isEmpty();
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class CollectionFacadeIT method testUpdateGroupPermissions.
@Test
public void testUpdateGroupPermissions() {
String collectionId = createCollection(CODE).getId();
SimplePermission groupPermission = new SimplePermission(GROUP, new HashSet<>(Arrays.asList(Role.SHARE, Role.READ)));
collectionFacade.updateGroupPermissions(collectionId, groupPermission);
Permissions permissions = collectionDao.getCollectionByCode(CODE).getPermissions();
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(permissions.getGroupPermissions(), groupPermission);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class CollectionFacadeIT method testGetCollectionPermissions.
@Test
public void testGetCollectionPermissions() {
String collectionId = createCollection(CODE).getId();
Permissions permissions = collectionFacade.getCollectionPermissions(collectionId);
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertPermissions(permissions.getGroupPermissions(), GROUP_PERMISSION);
}
use of io.lumeer.api.model.Permissions in project engine by Lumeer.
the class OrganizationFacadeIT method testRemoveGroupPermission.
@Test
public void testRemoveGroupPermission() {
createOrganization(CODE1);
organizationFacade.removeGroupPermission(CODE1, GROUP);
Permissions permissions = organizationDao.getOrganizationByCode(CODE1).getPermissions();
assertThat(permissions).isNotNull();
assertPermissions(permissions.getUserPermissions(), USER_PERMISSION);
assertThat(permissions.getGroupPermissions()).isEmpty();
}
Aggregations