Skip to content
Snippets Groups Projects

Draft: F acm permissions2

Closed Timm Fitschen requested to merge f-acm-permissions2 into dev
1 file
+ 26
7
Compare changes
  • Side-by-side
  • Inline
@@ -215,13 +215,7 @@ public class WriteTransaction extends Transaction<WritableContainer>
.setFile(oldEntity.getFileProperties().retrieveFromFileSystem());
}
try {
checkPermissions(entity, deriveUpdate(entity, oldEntity));
} catch (final AuthorizationException exc) {
entity.setEntityStatus(EntityStatus.UNQUALIFIED);
entity.addError(ServerMessages.AUTHORIZATION_ERROR);
entity.addInfo(exc.getMessage());
}
((UpdateEntity) entity).setOriginal(oldEntity);
}
break innerLoop;
}
@@ -290,6 +284,16 @@ public class WriteTransaction extends Transaction<WritableContainer>
@Override
protected void preCheck() throws InterruptedException, Exception {
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
if (entity.getEntityACL() == null) {
entity.setEntityACL(EntityACL.getOwnerACLFor(SecurityUtils.getSubject()));
@@ -373,6 +377,21 @@ public class WriteTransaction extends Transaction<WritableContainer>
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?
if (!Objects.equals(
newEntity.getQueryTemplateDefinition(), oldEntity.getQueryTemplateDefinition())) {
Loading