Skip to content
Snippets Groups Projects
Commit 692181d3 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

wip

parent f832e3f5
Branches
Tags
2 merge requests!111Release 0.12.1,!109F select acl
Pipeline #44383 failed
...@@ -31,6 +31,7 @@ import org.caosdb.server.database.BackendTransaction; ...@@ -31,6 +31,7 @@ import org.caosdb.server.database.BackendTransaction;
import org.caosdb.server.database.exceptions.EntityDoesNotExistException; import org.caosdb.server.database.exceptions.EntityDoesNotExistException;
import org.caosdb.server.datatype.CollectionValue; import org.caosdb.server.datatype.CollectionValue;
import org.caosdb.server.datatype.IndexedSingleValue; import org.caosdb.server.datatype.IndexedSingleValue;
import org.caosdb.server.accessControl.Principal;
import org.caosdb.server.datatype.ReferenceValue; import org.caosdb.server.datatype.ReferenceValue;
import org.caosdb.server.entity.EntityID; import org.caosdb.server.entity.EntityID;
import org.caosdb.server.entity.EntityInterface; import org.caosdb.server.entity.EntityInterface;
...@@ -60,6 +61,7 @@ import org.caosdb.server.utils.EntityStatus; ...@@ -60,6 +61,7 @@ import org.caosdb.server.utils.EntityStatus;
public class RetrieveFullEntityTransaction extends BackendTransaction { public class RetrieveFullEntityTransaction extends BackendTransaction {
private final Container<? extends EntityInterface> container; private final Container<? extends EntityInterface> container;
private final Principal principal;
public RetrieveFullEntityTransaction(final EntityInterface entity) { public RetrieveFullEntityTransaction(final EntityInterface entity) {
final Container<EntityInterface> c = new Container<>(); final Container<EntityInterface> c = new Container<>();
...@@ -67,8 +69,9 @@ public class RetrieveFullEntityTransaction extends BackendTransaction { ...@@ -67,8 +69,9 @@ public class RetrieveFullEntityTransaction extends BackendTransaction {
this.container = c; this.container = c;
} }
public RetrieveFullEntityTransaction(final Container<? extends EntityInterface> container) { public RetrieveFullEntityTransaction(final Container<? extends EntityInterface> container, final Principal principal) {
this.container = container; this.container = container;
this.principal = principal;
} }
public RetrieveFullEntityTransaction(final EntityID id) { public RetrieveFullEntityTransaction(final EntityID id) {
...@@ -226,7 +229,7 @@ public class RetrieveFullEntityTransaction extends BackendTransaction { ...@@ -226,7 +229,7 @@ public class RetrieveFullEntityTransaction extends BackendTransaction {
// check whether the referenced entity may be retrieved // check whether the referenced entity may be retrieved
final EntityACL entityACL = ref.getEntityACL(); final EntityACL entityACL = ref.getEntityACL();
if (!entityACL.isPermitted(SecurityUtils.getSubject(), EntityPermission.RETRIEVE_ENTITY)) { if (!entityACL.isPermitted(this.principal, EntityPermission.RETRIEVE_ENTITY)) {
return; return;
} }
// recursion! (Only for the matching selections) // recursion! (Only for the matching selections)
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
*/ */
package org.caosdb.server.entity; package org.caosdb.server.entity;
//TODO document the use of this class; it seems to exist of only constructors
public class RetrieveEntity extends Entity { public class RetrieveEntity extends Entity {
public RetrieveEntity() { public RetrieveEntity() {
......
...@@ -77,6 +77,10 @@ import org.caosdb.server.transaction.WriteTransaction; ...@@ -77,6 +77,10 @@ import org.caosdb.server.transaction.WriteTransaction;
import org.jdom2.Element; import org.jdom2.Element;
import org.slf4j.Logger; import org.slf4j.Logger;
// TODO Document: The query is initialized with a RetrieveTransaction and its
// Container. The container is filled by the Query with the resulting IDs. The
// Retrieve transaction then handles the retrieve of all respective Entities.
public class Query implements QueryInterface, ToElementable, EntityTransactionInterface { public class Query implements QueryInterface, ToElementable, EntityTransactionInterface {
/** Class which represents the selection of (sub)properties. */ /** Class which represents the selection of (sub)properties. */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment