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

BUG: Anonymous throws 500 in ScriptingResource

parent a034e7a4
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@ package caosdb.server.resource;
import caosdb.server.FileSystem;
import caosdb.server.accessControl.Principal;
import caosdb.server.accessControl.SessionToken;
import caosdb.server.accessControl.UserSources;
import caosdb.server.entity.FileProperties;
import caosdb.server.entity.Message;
import caosdb.server.scripting.CallerSerializer;
......@@ -82,6 +83,9 @@ public class ScriptingResource extends AbstractCaosDBServerResource {
@Override
protected Representation httpPostInChildClass(Representation entity) throws Exception {
if(isAnonymous()) {
throw ServerMessages.AUTHORIZATION_ERROR;
}
MediaType mediaType = entity.getMediaType();
try {
if (mediaType.equals(MediaType.MULTIPART_FORM_DATA, true)) {
......@@ -202,6 +206,11 @@ public class ScriptingResource extends AbstractCaosDBServerResource {
return SessionToken.generate((Principal) getUser().getPrincipal(), null);
}
boolean isAnonymous() {
boolean ret = getUser().hasRole(UserSources.ANONYMOUS_ROLE);
return ret;
}
public int callScript(
List<String> commandLine, Integer timeoutMs, List<FileProperties> files, Object authToken)
throws Message {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment