Sha256: f9024cb060bf8882bead17cc19409368cbcbce8c4c5e145e7f2763a0cf45403d

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 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
          update_management if @permission_template_access.manage?
        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 update_management
          Forms::PermissionTemplateForm.new(@permission_template_access.permission_template).update_management
        end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hyrax-2.0.0.rc1 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.beta5 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.beta4 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.beta3 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.beta2 app/controllers/hyrax/admin/permission_template_accesses_controller.rb
hyrax-2.0.0.beta1 app/controllers/hyrax/admin/permission_template_accesses_controller.rb