Sha256: 49297396b5ffbefe9145edb21cee781a732adf7b0e01adf4b8deea2156187ca6

Contents?: true

Size: 1.92 KB

Versions: 32

Compression:

Stored size: 1.92 KB

Contents

module Hyrax
  module Ability
    module AdminSetAbility
      def admin_set_abilities # rubocop:disable Metrics/MethodLength
        if admin?
          can :manage, AdminSet
          can :manage_any, AdminSet
          can :create_any, AdminSet
          can :view_admin_show_any, AdminSet
        else
          can :manage_any, AdminSet if Hyrax::Collections::PermissionsService.can_manage_any_admin_set?(ability: self)
          can [:create_any, :create], AdminSet if Hyrax::CollectionTypes::PermissionsService.can_create_admin_set_collection_type?(ability: self)
          can :view_admin_show_any, AdminSet if Hyrax::Collections::PermissionsService.can_view_admin_show_for_any_admin_set?(ability: self)

          can [:edit, :update, :destroy], AdminSet do |admin_set| # for test by solr_doc, see solr_document_ability.rb
            test_edit(admin_set.id)
          end

          can :deposit, AdminSet do |admin_set| # for test by solr_doc, see collection_ability.rb
            Hyrax::Collections::PermissionsService.can_deposit_in_collection?(ability: self, collection_id: admin_set.id)
          end

          can :view_admin_show, AdminSet do |admin_set| # admin show page # for test by solr_doc, see collection_ability.rb
            Hyrax::Collections::PermissionsService.can_view_admin_show_for_collection?(ability: self, collection_id: admin_set.id)
          end

          # TODO: I don't think these are needed anymore since there isn't a public show page.  Should be checking :view_admin_show ability
          can :read, AdminSet do |admin_set| # for test by solr_doc, see solr_document_ability.rb
            test_read(admin_set.id)
          end
        end

        # TODO: I'm not sure why this is checked with AdminSet abilities.  It was before the refactor and since I'm not sure what the connection is, I left it here.
        can :review, :submissions do
          can_review_submissions?
        end
      end
    end
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.5 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.4 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.3 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.2 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.9.0 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.8.0 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.7.2 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.7.1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.7.0 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.6.0 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-3.0.0.pre.rc1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-3.0.0.pre.beta3 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.5.1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.5.0 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-3.0.0.pre.beta2 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.4.1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-3.0.0.pre.beta1 app/models/concerns/hyrax/ability/admin_set_ability.rb
hyrax-2.4.0 app/models/concerns/hyrax/ability/admin_set_ability.rb