Commit b8db479577a99c7e2f18fcdb99f295947d7b14fc
1 parent
455e2878
Exists in
master
and in
3 other branches
Make only the admin see the additional fields on rate list
Signed-off-by: Fabio Teixeira <fabio1079@gmail.com>
Showing
1 changed file
with
10 additions
and
7 deletions
Show diff stats
lib/gov_user_plugin.rb
| @@ -238,13 +238,16 @@ class GovUserPlugin < Noosfero::Plugin | @@ -238,13 +238,16 @@ class GovUserPlugin < Noosfero::Plugin | ||
| 238 | end | 238 | end |
| 239 | 239 | ||
| 240 | def communities_ratings_plugin_extra_fields_show_data user_rating | 240 | def communities_ratings_plugin_extra_fields_show_data user_rating |
| 241 | - is_admin = environment.admins.include?(current_user.person) | ||
| 242 | - | ||
| 243 | - if is_admin and context.profile.software? | ||
| 244 | - Proc::new { | ||
| 245 | - render :file => 'communities_ratings_extra_fields_show_institution', | ||
| 246 | - :locals => {:user_rating => user_rating} | ||
| 247 | - } | 241 | + if logged_in? |
| 242 | + is_admin = environment.admins.include?(current_user.person) | ||
| 243 | + is_admin ||= user_rating.community.admins.include?(current_user.person) | ||
| 244 | + | ||
| 245 | + if is_admin and context.profile.software? | ||
| 246 | + Proc::new { | ||
| 247 | + render :file => 'communities_ratings_extra_fields_show_institution', | ||
| 248 | + :locals => {:user_rating => user_rating} | ||
| 249 | + } | ||
| 250 | + end | ||
| 248 | end | 251 | end |
| 249 | end | 252 | end |
| 250 | 253 |