Sha256: 692a9e184f899f113ba8ad1017e36a7fc53694532630f47c45458b93923e9ca1

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

module Hyrax
  module Admin
    class PermissionTemplateAccessesController < ApplicationController
      load_and_authorize_resource class: 'Hyrax::PermissionTemplateAccess'

      def destroy
        ActiveRecord::Base.transaction do
          @permission_template_access.destroy
          remove_access!
        end

        if @permission_template_access.destroyed?
          redirect_to hyrax.edit_admin_admin_set_path(admin_set_id,
                                                      anchor: 'participants'),
                      notice: translate('participants', scope: 'hyrax.admin.admin_sets.form.permission_update_notices')
        else
          redirect_to hyrax.edit_admin_admin_set_path(admin_set_id,
                                                      anchor: 'participants'),
                      alert: @permission_template_access.errors.full_messages.to_sentence

        end
      end

      private

        # @return [String] the identifier for the AdminSet for the currently loaded resource
        def admin_set_id
          @admin_set_id ||= @permission_template_access.permission_template.admin_set_id
        end

        def remove_access!
          Forms::PermissionTemplateForm.new(@permission_template_access.permission_template)
                                       .remove_access!(@permission_template_access)
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyrax-2.0.3 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.2 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.1 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.rc3 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.rc2 app/controllers/hyrax/admin/permission_template_accesses_controller.rb