From f5acdbd0148b0222a6545c5f47ba99b7c4f0feb3 Mon Sep 17 00:00:00 2001 From: Rodrigo Souto Date: Mon, 17 Oct 2011 20:57:34 -0300 Subject: [PATCH] Blocking access from Bsc to destroy produts --- plugins/bsc/lib/bsc_plugin.rb | 11 +++++++++++ 1 file changed, 11 insertions(+), 0 deletions(-) diff --git a/plugins/bsc/lib/bsc_plugin.rb b/plugins/bsc/lib/bsc_plugin.rb index 6204bbc..a3075f2 100644 --- a/plugins/bsc/lib/bsc_plugin.rb +++ b/plugins/bsc/lib/bsc_plugin.rb @@ -84,6 +84,17 @@ class BscPlugin < Noosfero::Plugin end end + def manage_products_controller_filters + if bsc?(profile) + [{ :type => 'before_filter', + :method_name => 'manage_products_bsc_destroy_access', + :options => {:only => :destroy}, + :block => lambda { render_access_denied } }] + else + [] + end + end + def asset_product_properties(product) properties = [] properties << { :name => _('Bsc'), :content => lambda { link_to(product.bsc.name, product.bsc.url) } } if product.bsc -- libgit2 0.21.2