noosfero | Add environment permission to not allow user to delete a profile (#648)

Daniela Feitosa gitlab at gitlab.com
Fri Aug 7 08:50:17 BRT 2015


New comment for Merge Request 648

https://gitlab.com/noosfero/noosfero/merge_requests/648#note_1843791


Daniela Feitosa

This `else` is for the condition `if environment.admins.include?(current_person) && profile.visible?`, that has a `&&`. So, if the user is not admin and the profile is visible, he will fall in this `else`.

As those (Activate|Deactivate) profile button should be displayed only to admins, you should leave the verification that the user is admin alone, like:
```
<% if user.is_admin?(environment) %>
  <% if profile.visible? %>
    <%= button(:remove, _('Deactivate profile'), {:action => :deactivate_profile, :id=>profile.id}, :id=>'deactivate_
  <% else %>
    <%= button(:add, _('Activate profile'), {:action => :activate_profile, :id=>profile.id}, :data => {:confirm=>_("A
  <% end %>
<% end %>
```

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20150807/a8976ea5/attachment.html>


More information about the Noosfero-dev mailing list