From 0499d38412d15a3524b27afb5cb61ab01e42f617 Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 15 Dec 2010 11:18:37 +0100 Subject: get subjectid also out of request headers for delete --- application.rb | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/application.rb b/application.rb index 99e4619..a2fbd37 100644 --- a/application.rb +++ b/application.rb @@ -56,23 +56,25 @@ get '/?' do # get index of models end delete '/:id/?' do - begin - uri = ModelStore.get(params[:id]).uri - ModelStore.get(params[:id]).destroy! - "Model #{params[:id]} deleted." - if params[:subjectid] and !ModelStore.get(params[:id]) and uri + begin + uri = ModelStore.get(params[:id]).uri + ModelStore.get(params[:id]).destroy! + "Model #{params[:id]} deleted." + subjectid = params[:subjectid] if params[:subjectid] + subjectid = request.env['HTTP_SUBJECTID'] if !subjectid and request.env['HTTP_SUBJECTID'] + if subjectid and !ModelStore.get(params[:id]) and uri begin - aa = OpenTox::Authorization.delete_policies_from_uri(uri, params[:subjectid]) - LOGGER.debug "Policy deleted for Model URI: #{uri} with subjectid: #{params[:subjectid]} with result: #{aa}" + res = OpenTox::Authorization.delete_policies_from_uri(uri, subjectid) + LOGGER.debug "Policy deleted for Model URI: #{uri} with subjectid: #{subjectid} with result: #{res}" rescue LOGGER.warn "Policy delete error for Model URI: #{uri}" end end response['Content-Type'] = 'text/plain' "Model #{params[:id]} deleted." - rescue - halt 404, "Model #{params[:id]} does not exist." - end + rescue + halt 404, "Model #{params[:id]} does not exist." + end end -- cgit v1.2.3 From e2cb62d02a4239de3fcc132c0bd077a2aadc0f09 Mon Sep 17 00:00:00 2001 From: mr Date: Thu, 16 Dec 2010 10:55:35 +0100 Subject: A&A for lazar.predict_dataset --- lazar.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lazar.rb b/lazar.rb index ba34361..8226b06 100644 --- a/lazar.rb +++ b/lazar.rb @@ -92,7 +92,7 @@ post '/:id/?' do end elsif dataset_uri task = OpenTox::Task.create("Predict dataset",url_for("/#{@lazar.id}", :full)) do - @lazar.predict_dataset(dataset_uri).uri + @lazar.predict_dataset(dataset_uri, subjectid).uri end halt 503,task.uri+"\n" if task.status == "Cancelled" halt 202,task.uri -- cgit v1.2.3