Class: Hyrax::Transactions::Steps::DeletePermissionTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/hyrax/transactions/steps/delete_permission_template.rb

Overview

Deletes the Hyrax::PermissionTemplate for a resource. If no PermissionTemplate associated with that resource is found, succeeds.

Instance Method Summary collapse

Instance Method Details

#call(obj) ⇒ Dry::Monads::Result

Since:

  • 2.4.0



19
20
21
22
23
24
25
26
# File 'lib/hyrax/transactions/steps/delete_permission_template.rb', line 19

def call(obj)
  permission_template = Hyrax::PermissionTemplate.find_by(source_id: obj.id)
  return Success(obj) if permission_template.nil?

  permission_template.destroy || (return Failure[:failed_to_delete_permission_template, permission_template])

  Success(obj)
end