use of org.molgenis.data.security.EntityTypeIdentity in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecoratorTest method findOneByIdFetchUserPermissionDenied.
@WithMockUser(username = USERNAME)
@Test
public void findOneByIdFetchUserPermissionDenied() {
String entityType0Name = "entity0";
Fetch fetch = mock(Fetch.class);
when(permissionService.hasPermission(new EntityTypeIdentity(entityType0Name), EntityTypePermission.COUNT)).thenReturn(false);
assertNull(repo.findOneById(entityType0Name, fetch));
}
use of org.molgenis.data.security.EntityTypeIdentity in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecorator method deleteAcl.
@Override
public void deleteAcl(Object entityTypeId) {
mutableAclService.deleteAcl(new EntityTypeIdentity((String) entityTypeId), true);
mutableAclClassService.deleteAclClass(EntityIdentityUtils.toType((String) entityTypeId));
}
use of org.molgenis.data.security.EntityTypeIdentity in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecorator method createAcl.
@Override
public void createAcl(EntityType entityType) {
MutableAcl acl = mutableAclService.createAcl(new EntityTypeIdentity(entityType.getId()));
Package pack = entityType.getPackage();
if (pack != null) {
ObjectIdentity objectIdentity = new PackageIdentity(pack);
acl.setParent(mutableAclService.readAclById(objectIdentity));
mutableAclService.updateAcl(acl);
}
}
use of org.molgenis.data.security.EntityTypeIdentity in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecorator method isOperationPermitted.
@Override
public boolean isOperationPermitted(Object id, Action action) {
AbstractPermission permission = getPermissionForOperation(action);
boolean hasPermission = userPermissionEvaluator.hasPermission(new EntityTypeIdentity(id.toString()), permission);
if (hasPermission && !permission.equals(EntityTypePermission.COUNT)) {
boolean isSystem = systemEntityTypeRegistry.hasSystemEntityType(id.toString());
if (isSystem && !currentUserIsSystem()) {
throw new MolgenisDataException(format("No [%s] permission on EntityType [%s]", toMessagePermission(action), id));
}
}
return hasPermission;
}
use of org.molgenis.data.security.EntityTypeIdentity in project molgenis by molgenis.
the class EntityTypeRepositorySecurityDecorator method deleteAcl.
@Override
public void deleteAcl(EntityType entityType) {
mutableAclService.deleteAcl(new EntityTypeIdentity(entityType), true);
mutableAclClassService.deleteAclClass(EntityIdentityUtils.toType(entityType));
}
Aggregations