From 763cdff161108afdcd19e31ed0dbfe6dc2a5e078 Mon Sep 17 00:00:00 2001 From: mr Date: Tue, 20 Jul 2010 15:26:07 +0200 Subject: pre merge with helma/master --- application.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'application.rb') 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 -- cgit v1.2.3