Created
November 23, 2011 20:18
-
-
Save Znow/1389777 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def initialize(user) | |
user ||= User.new | |
if user.super_admin? | |
can :manage, :all | |
elsif user.admin? | |
can :manage, News | |
can :manage, Video | |
can :manage, Employee | |
#can :manage, #Admin::AdvicePages | |
can [:read, :update], User, :id => user.id | |
elsif user.investor? | |
can :read, News | |
can [:read, :update], User, :id => user.id | |
else # default role for newly created account, "visitor" | |
can :read, News | |
can [:read, :update], User, :id => user.id | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- if can? :manage, @news | |
%td | |
.notice | |
= link_to 'Vis', news | |
= link_to 'Rediger', edit_news_path(news) | |
= link_to 'Slet', news, :confirm => 'Er du sikker?', :method => :delete |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment