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

WIP: fix #196

parent fa687d47
No related branches found
No related tags found
2 merge requests!96DOC: Added CITATION.cff to the list of files in the release guide where the...,!84fixing server issue #196
Pipeline #35130 passed
...@@ -28,6 +28,7 @@ import org.caosdb.server.accessControl.ACMPermissions; ...@@ -28,6 +28,7 @@ import org.caosdb.server.accessControl.ACMPermissions;
import org.caosdb.server.entity.DeleteEntity; import org.caosdb.server.entity.DeleteEntity;
import org.caosdb.server.entity.EntityInterface; import org.caosdb.server.entity.EntityInterface;
import org.caosdb.server.entity.InsertEntity; import org.caosdb.server.entity.InsertEntity;
import org.caosdb.server.entity.Role;
import org.caosdb.server.entity.UpdateEntity; import org.caosdb.server.entity.UpdateEntity;
import org.caosdb.server.jobs.ContainerJob; import org.caosdb.server.jobs.ContainerJob;
import org.caosdb.server.jobs.JobAnnotation; import org.caosdb.server.jobs.JobAnnotation;
...@@ -47,12 +48,15 @@ public class AccessControl extends ContainerJob { ...@@ -47,12 +48,15 @@ public class AccessControl extends ContainerJob {
super(permission, description); super(permission, description);
} }
public final String toString(String entityRole) { public final String toString(Role entityRole) {
return toString().replace(ENTITY_ROLE_PARAMETER, entityRole); String roleString = entityRole == null ? "" : entityRole.toString();
return toString().replace(ENTITY_ROLE_PARAMETER, roleString);
} }
public final String toString(String transaction, String entityRole) { public final String toString(String transaction, Role entityRole) {
return "TRANSACTION:" + transaction + (entityRole != null ? (":" + entityRole) : ""); return "TRANSACTION:"
+ transaction
+ (entityRole != null ? (":" + entityRole.toString()) : "");
} }
public static String init() { public static String init() {
...@@ -87,17 +91,16 @@ public class AccessControl extends ContainerJob { ...@@ -87,17 +91,16 @@ public class AccessControl extends ContainerJob {
for (final EntityInterface e : getContainer()) { for (final EntityInterface e : getContainer()) {
// per role permission
if (e instanceof InsertEntity) { if (e instanceof InsertEntity) {
if (subject.isPermitted(INSERT.toString(e.getRole().toString()))) { if (subject.isPermitted(INSERT.toString(e.getRole()))) {
continue; continue;
} }
} else if (e instanceof DeleteEntity) { } else if (e instanceof DeleteEntity) {
if (subject.isPermitted(DELETE.toString(e.getRole().toString()))) { if (subject.isPermitted(DELETE.toString(e.getRole()))) {
continue; continue;
} }
} else if (e instanceof UpdateEntity) { } else if (e instanceof UpdateEntity) {
if (subject.isPermitted(UPDATE.toString(e.getRole().toString()))) { if (subject.isPermitted(UPDATE.toString(e.getRole()))) {
continue; continue;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment