Module: Spotlight::Ability
Overview
Default Spotlight CanCan abilities
Instance Method Summary collapse
-
#initialize(user) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength.
Instance Method Details
#initialize(user) ⇒ Object
rubocop:disable Metrics/AbcSize, Metrics/MethodLength
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/models/spotlight/ability.rb', line 10 def initialize(user) user ||= Spotlight::Engine.user_class.new alias_action :process_import, to: :import can :manage, :all if user.superadmin? # exhibit admin can %i[update import export destroy], Spotlight::Exhibit, id: user.admin_roles.pluck(:resource_id) can :manage, [Spotlight::BlacklightConfiguration, Spotlight::ContactEmail, Spotlight::Language], exhibit_id: user.admin_roles.pluck(:resource_id) can :manage, Spotlight::Role, resource_id: user.admin_roles.pluck(:resource_id), resource_type: 'Spotlight::Exhibit' can :manage, [PaperTrail::Version, Spotlight::FeaturedImage] if user.exhibit_roles.any? # exhibit curator can :manage, [ Spotlight::Attachment, Spotlight::Search, Spotlight::Group, Spotlight::Resource, Spotlight::Page, Spotlight::Contact, Spotlight::CustomField, Spotlight::CustomSearchField, Translation ], exhibit_id: user.exhibit_roles.pluck(:resource_id) can :read, Spotlight::JobTracker, on_id: user.exhibit_roles.pluck(:resource_id), on_type: 'Spotlight::Exhibit' can :manage, Spotlight::Lock, by: user can :read, Spotlight::Language, exhibit_id: user.exhibit_roles.pluck(:resource_id) can %i[read curate tag bulk_update], Spotlight::Exhibit, id: user.exhibit_roles.pluck(:resource_id) # public can :read, Spotlight::HomePage can :read, Spotlight::Exhibit, published: true can :read, Spotlight::Page, published: true can :read, Spotlight::Search, published: true can :read, Spotlight::Group, published: true can :read, Spotlight::Language, public: true can :read, Spotlight::Exhibit, id: user.viewer_roles.pluck(:resource_id) end |