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

remove unnecessary changes

parent 0300902d
No related branches found
No related tags found
3 merge requests!21Release v0.4.0,!7F fsm,!6Draft: F acm permissions2
Pipeline #5938 passed
......@@ -22,21 +22,11 @@
*/
package org.caosdb.server.entity;
import org.caosdb.server.transaction.WriteTransaction;
import org.caosdb.server.utils.EntityStatus;
import org.jdom2.Element;
/**
* UpdateEntity class represents entities which are to be updated. The previous version is appeded
* during the {@link WriteTransaction} transactions initialization.
*
* @author Timm Fitschen <t.fitschen@indiscale.com>
*/
public class UpdateEntity extends WritableEntity {
/** The previous version of this entity. */
private EntityInterface original = null;
public UpdateEntity(final Element element) {
super(element);
}
......@@ -45,12 +35,4 @@ public class UpdateEntity extends WritableEntity {
public boolean skipJob() {
return getEntityStatus() != EntityStatus.QUALIFIED;
}
public void setOriginal(EntityInterface original) {
this.original = original;
}
public EntityInterface getOriginal() {
return this.original;
}
}
......@@ -215,7 +215,13 @@ public class WriteTransaction extends Transaction<WritableContainer>
.setFile(oldEntity.getFileProperties().retrieveFromFileSystem());
}
((UpdateEntity) entity).setOriginal(oldEntity);
try {
checkPermissions(entity, deriveUpdate(entity, oldEntity));
} catch (final AuthorizationException exc) {
entity.setEntityStatus(EntityStatus.UNQUALIFIED);
entity.addError(ServerMessages.AUTHORIZATION_ERROR);
entity.addInfo(exc.getMessage());
}
}
break innerLoop;
}
......@@ -284,18 +290,6 @@ public class WriteTransaction extends Transaction<WritableContainer>
@Override
protected void preCheck() throws InterruptedException, Exception {
for (final EntityInterface entity : getContainer()) {
try {
if (entity.getEntityStatus() == EntityStatus.QUALIFIED) {
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()));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment