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

WIP: fix #196

parent fa687d47
Branches
Tags
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;
import org.caosdb.server.entity.DeleteEntity;
import org.caosdb.server.entity.EntityInterface;
import org.caosdb.server.entity.InsertEntity;
import org.caosdb.server.entity.Role;
import org.caosdb.server.entity.UpdateEntity;
import org.caosdb.server.jobs.ContainerJob;
import org.caosdb.server.jobs.JobAnnotation;
......@@ -47,12 +48,15 @@ public class AccessControl extends ContainerJob {
super(permission, description);
}
public final String toString(String entityRole) {
return toString().replace(ENTITY_ROLE_PARAMETER, entityRole);
public final String toString(Role entityRole) {
String roleString = entityRole == null ? "" : entityRole.toString();
return toString().replace(ENTITY_ROLE_PARAMETER, roleString);
}
public final String toString(String transaction, String entityRole) {
return "TRANSACTION:" + transaction + (entityRole != null ? (":" + entityRole) : "");
public final String toString(String transaction, Role entityRole) {
return "TRANSACTION:"
+ transaction
+ (entityRole != null ? (":" + entityRole.toString()) : "");
}
public static String init() {
......@@ -87,17 +91,16 @@ public class AccessControl extends ContainerJob {
for (final EntityInterface e : getContainer()) {
// per role permission
if (e instanceof InsertEntity) {
if (subject.isPermitted(INSERT.toString(e.getRole().toString()))) {
if (subject.isPermitted(INSERT.toString(e.getRole()))) {
continue;
}
} else if (e instanceof DeleteEntity) {
if (subject.isPermitted(DELETE.toString(e.getRole().toString()))) {
if (subject.isPermitted(DELETE.toString(e.getRole()))) {
continue;
}
} else if (e instanceof UpdateEntity) {
if (subject.isPermitted(UPDATE.toString(e.getRole().toString()))) {
if (subject.isPermitted(UPDATE.toString(e.getRole()))) {
continue;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment