Sha256: 84f01c10e39199caf4d30558329d5b2785824b6d11a0063dac76517c64f7e393
Contents?: true
Size: 937 Bytes
Versions: 10
Compression:
Stored size: 937 Bytes
Contents
class Ability include CanCan::Ability def initialize(user) if !user.nil? and (user.admin? or user.manager?) can :read, :all can :access, :rails_admin # grant access to rails_admin can :dashboard # grant access to the dashboard if user.admin? admin_ui(user) elsif user.manager? manager_ui(user) end cannot [:new, :create], Enjoy::Seo cannot [:new, :create], Enjoy::SitemapData end end def admin_ui(user) can :manage, :all end def manager_ui(user) cannot :manage, Enjoy::Menu cannot [:edit, :destroy, :new, :create], User can :edit, user manager_models.each do |model| can manager_actions, model end end def manager_actions [:edit, :new, :create, :nested_set, :sort_embedded] end def manager_models [ Enjoy::Page, Enjoy::News, Enjoy::Seo, Enjoy::SitemapData ] end end
Version data entries
10 entries across 10 versions & 1 rubygems