Sha256: 4d8fa7240d3a200c1dbaa7eff07ec196f37eced980616dc6deec432b2b87d315
Contents?: true
Size: 1 KB
Versions: 13
Compression:
Stored size: 1 KB
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 can :comments, :all #RailsAdminComments 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, RailsAdminSettings::Setting ] end end
Version data entries
13 entries across 13 versions & 1 rubygems