Commit 4fd2a0c0aefd432ecb2d177d4c9c1714ef04bc2e

Authored by Evandro Junior
1 parent ecb3bad5
Exists in master

Fixed permissions

controllers/email_article_plugin_myprofile_controller.rb
1 class EmailArticlePluginMyprofileController < MyProfileController 1 class EmailArticlePluginMyprofileController < MyProfileController
2 2
3 needs_profile 3 needs_profile
  4 +
4 # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add] 5 # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add]
5 # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail] 6 # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail]
6 # before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail] 7 # before_filter :login_required, :only => [:add, :join, :join_not_logged, :leave, :unblock, :leave_scrap, :remove_scrap, :remove_activity, :view_more_activities, :view_more_network_activities, :report_abuse, :register_report, :leave_comment_on_activity, :send_mail]
7 8
8 def send_email 9 def send_email
9 - article = Article.find(params[:id])  
10 - EmailArticlePluginMyprofileController::Sender.deliver_mail(article)  
11 - render :text=>'ok' 10 + if user.is_admin?(profile)
  11 + article = Article.find(params[:id])
  12 + EmailArticlePluginMyprofileController::Sender.deliver_mail(article)
  13 + render :text=>'ok'
  14 + end
12 end 15 end
13 16
14 class Sender < ActionMailer::Base 17 class Sender < ActionMailer::Base
lib/email_article_plugin.rb
@@ -12,7 +12,8 @@ class EmailArticlePlugin &lt; Noosfero::Plugin @@ -12,7 +12,8 @@ class EmailArticlePlugin &lt; Noosfero::Plugin
12 label = _("Send article to members") 12 label = _("Send article to members")
13 htmlclass = _("button with-text icon-menu-mail") 13 htmlclass = _("button with-text icon-menu-mail")
14 title = _("Email article to all community members") 14 title = _("Email article to all community members")
15 - lambda { 15 + lambda {
  16 + if user.is_admin?(profile) and @page.kind_of?(TextArticle)
16 link_to_remote( 17 link_to_remote(
17 label, 18 label,
18 { 19 {
@@ -25,11 +26,7 @@ class EmailArticlePlugin &lt; Noosfero::Plugin @@ -25,11 +26,7 @@ class EmailArticlePlugin &lt; Noosfero::Plugin
25 :class => htmlclass, 26 :class => htmlclass,
26 :title => title 27 :title => title
27 ) 28 )
28 - } 29 + end
  30 + }
29 end 31 end
30 -  
31 - def stylesheet?  
32 - true  
33 - end  
34 -  
35 end 32 end