Commit 4fd2a0c0aefd432ecb2d177d4c9c1714ef04bc2e
1 parent
ecb3bad5
Exists in
master
Fixed permissions
Showing
2 changed files
with
10 additions
and
10 deletions
Show diff stats
controllers/email_article_plugin_myprofile_controller.rb
1 | 1 | class EmailArticlePluginMyprofileController < MyProfileController |
2 | 2 | |
3 | 3 | needs_profile |
4 | + | |
4 | 5 | # before_filter :check_access_to_profile, :except => [:join, :join_not_logged, :index, :add] |
5 | 6 | # before_filter :store_location, :only => [:join, :join_not_logged, :report_abuse, :send_mail] |
6 | 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 | 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 | 15 | end |
13 | 16 | |
14 | 17 | class Sender < ActionMailer::Base | ... | ... |
lib/email_article_plugin.rb
... | ... | @@ -12,7 +12,8 @@ class EmailArticlePlugin < Noosfero::Plugin |
12 | 12 | label = _("Send article to members") |
13 | 13 | htmlclass = _("button with-text icon-menu-mail") |
14 | 14 | title = _("Email article to all community members") |
15 | - lambda { | |
15 | + lambda { | |
16 | + if user.is_admin?(profile) and @page.kind_of?(TextArticle) | |
16 | 17 | link_to_remote( |
17 | 18 | label, |
18 | 19 | { |
... | ... | @@ -25,11 +26,7 @@ class EmailArticlePlugin < Noosfero::Plugin |
25 | 26 | :class => htmlclass, |
26 | 27 | :title => title |
27 | 28 | ) |
28 | - } | |
29 | + end | |
30 | + } | |
29 | 31 | end |
30 | - | |
31 | - def stylesheet? | |
32 | - true | |
33 | - end | |
34 | - | |
35 | 32 | end | ... | ... |