Sha256: 5c8c72f88799d479251d3b44d465c796349f004918e19cd7e12d29578545bc78

Contents?: true

Size: 397 Bytes

Versions: 9

Compression:

Stored size: 397 Bytes

Contents

#module EnjuNews
  class Ability
    include CanCan::Ability
    
    def initialize(user, ip_address = nil)
      case user.try(:role).try(:name)
      when 'Administrator'
        can :manage, [NewsFeed, NewsPost]
      when 'Librarian'
        can :read, [NewsFeed, NewsPost]
      when 'User'
        can :read, [NewsPost]
      else
        can :read, [NewsPost]
      end
    end
  end
#end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
enju_news-0.1.1 spec/dummy/app/models/ability.rb
enju_news-0.1.0 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre9 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre8 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre7 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre6 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre5 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre4 spec/dummy/app/models/ability.rb
enju_news-0.1.0.pre3 spec/dummy/app/models/ability.rb