Skip to content
Snippets Groups Projects
Verified Commit e326435d authored by Timm Fitschen's avatar Timm Fitschen
Browse files

fix tests

parent b92ef8d3
Branches
Tags
3 merge requests!21Release v0.4.0,!7F fsm,!6Draft: F acm permissions2
Pipeline #5873 failed
...@@ -215,13 +215,7 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -215,13 +215,7 @@ public class WriteTransaction extends Transaction<WritableContainer>
.setFile(oldEntity.getFileProperties().retrieveFromFileSystem()); .setFile(oldEntity.getFileProperties().retrieveFromFileSystem());
} }
try { ((UpdateEntity) entity).setOriginal(oldEntity);
checkPermissions(entity, deriveUpdate(entity, oldEntity));
} catch (final AuthorizationException exc) {
entity.setEntityStatus(EntityStatus.UNQUALIFIED);
entity.addError(ServerMessages.AUTHORIZATION_ERROR);
entity.addInfo(exc.getMessage());
}
} }
break innerLoop; break innerLoop;
} }
...@@ -290,6 +284,16 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -290,6 +284,16 @@ public class WriteTransaction extends Transaction<WritableContainer>
@Override @Override
protected void preCheck() throws InterruptedException, Exception { protected void preCheck() throws InterruptedException, Exception {
for (final EntityInterface entity : getContainer()) { for (final EntityInterface entity : getContainer()) {
try {
checkPermissions(entity, deriveUpdate(entity, ((UpdateEntity) entity).getOriginal()));
} catch (final AuthorizationException exc) {
entity.setEntityStatus(EntityStatus.UNQUALIFIED);
entity.addError(ServerMessages.AUTHORIZATION_ERROR);
entity.addInfo(exc.getMessage());
} catch (ClassCastException exc) {
// not an update entity. ignore.
}
// set default EntityACL if none present // set default EntityACL if none present
if (entity.getEntityACL() == null) { if (entity.getEntityACL() == null) {
entity.setEntityACL(EntityACL.getOwnerACLFor(SecurityUtils.getSubject())); entity.setEntityACL(EntityACL.getOwnerACLFor(SecurityUtils.getSubject()));
...@@ -373,6 +377,21 @@ public class WriteTransaction extends Transaction<WritableContainer> ...@@ -373,6 +377,21 @@ public class WriteTransaction extends Transaction<WritableContainer>
newEntity.setEntityACL(oldEntity.getEntityACL()); newEntity.setEntityACL(oldEntity.getEntityACL());
} }
// new acl?
if (newEntity.hasEntityACL() && !newEntity.getEntityACL().equals(oldEntity.getEntityACL())) {
oldEntity.checkPermission(EntityPermission.EDIT_ACL);
if (!newEntity
.getEntityACL()
.getPriorityEntityACL()
.equals(oldEntity.getEntityACL().getPriorityEntityACL())) {
// priority acl is to be changed?
oldEntity.checkPermission(Permission.EDIT_PRIORITY_ACL);
}
updatetable = true;
} else if (!newEntity.hasEntityACL()) {
newEntity.setEntityACL(oldEntity.getEntityACL());
}
// new query template definition? // new query template definition?
if (!Objects.equals( if (!Objects.equals(
newEntity.getQueryTemplateDefinition(), oldEntity.getQueryTemplateDefinition())) { newEntity.getQueryTemplateDefinition(), oldEntity.getQueryTemplateDefinition())) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment