Class: Hyrax::Transactions::Steps::CheckForDefaultAdminSet
- Inherits:
-
Object
- Object
- Hyrax::Transactions::Steps::CheckForDefaultAdminSet
- Defined in:
- lib/hyrax/transactions/steps/check_for_default_admin_set.rb
Overview
Validates non-defaultness of the AdministrativeSet; gives ‘Success` when not the default and `Failure` otherwise.
Use this step to guard against destroying the default AdminSet.
Instance Method Summary collapse
- #call(admin_set) ⇒ Dry::Monads::Result
-
#initialize(query_service: Hyrax.query_service) ⇒ CheckForDefaultAdminSet
constructor
A new instance of CheckForDefaultAdminSet.
Constructor Details
#initialize(query_service: Hyrax.query_service) ⇒ CheckForDefaultAdminSet
Returns a new instance of CheckForDefaultAdminSet.
17 18 19 |
# File 'lib/hyrax/transactions/steps/check_for_default_admin_set.rb', line 17 def initialize(query_service: Hyrax.query_service) @query_service = query_service end |
Instance Method Details
#call(admin_set) ⇒ Dry::Monads::Result
25 26 27 28 |
# File 'lib/hyrax/transactions/steps/check_for_default_admin_set.rb', line 25 def call(admin_set) return Failure["Administrative set cannot be deleted as it is the default set", admin_set] if admin_set.id == Hyrax.config.default_admin_set_id Success(admin_set) end |