diff options
author | mr <mr@mrautenberg.de> | 2011-01-11 17:01:53 +0100 |
---|---|---|
committer | mr <mr@mrautenberg.de> | 2011-01-11 17:01:53 +0100 |
commit | 6edd4387f6e1eaf0178321ca97d9814deb8f3e1f (patch) | |
tree | 69d13080ba6d2950c4687cea9749a720b1b49315 /application.rb | |
parent | 96356b0d439342b9132847b9f6c38cb7a10206c8 (diff) |
get metadata for models / indenting
Diffstat (limited to 'application.rb')
-rw-r--r-- | application.rb | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/application.rb b/application.rb index 99e4619..4fc749d 100644 --- a/application.rb +++ b/application.rb @@ -52,27 +52,30 @@ end get '/?' do # get index of models response['Content-Type'] = 'text/uri-list' + params.delete_if{|k,v| k=="subjectid"} ModelStore.all(params).collect{|m| m.uri}.join("\n") + "\n" 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 |