summaryrefslogtreecommitdiff
path: root/application.rb
diff options
context:
space:
mode:
authormr <mr@mrautenberg.de>2010-07-20 15:26:07 +0200
committermr <mr@mrautenberg.de>2010-07-20 15:26:07 +0200
commit763cdff161108afdcd19e31ed0dbfe6dc2a5e078 (patch)
treed8d722602f098a1d0ea0358eee448ada6b4b765d /application.rb
parentd761fe098ee419ae3943fefe105922133cb863fd (diff)
pre merge with helma/master
Diffstat (limited to 'application.rb')
-rw-r--r--application.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/application.rb b/application.rb
index 304f8c0..6229178 100644
--- a/application.rb
+++ b/application.rb
@@ -8,7 +8,8 @@ class Model
property :id, Serial
property :uri, String, :length => 255
property :owl, Text, :length => 2**32-1
- property :yaml, Text, :length => 2**32-1
+ property :yaml, Text, :length => 2**32-1
+ property :token_id, String, :length => 255
property :created_at, DateTime
end
@@ -23,8 +24,17 @@ end
delete '/:id/?' do
begin
- Model.get(params[:id]).destroy!
+ model = Model.get(params[:id])
+ uri = model.uri
+ model.destroy!
"Model #{params[:id]} deleted."
+ if params["token_id"] and !Model.get(params[:id]) and uri
+ begin
+ aa = OpenTox::Authorization.delete_policy_from_uri(uri, params["token_id"])
+ rescue
+ LOGGER.warn "Policy delete error for Model URI: #{uri}"
+ end
+ end
rescue
halt 404, "Model #{params[:id]} does not exist."
end