Sha256: 76603634f735959988dc56e85c2c8ea9dd085006559771e3cfdd7f8e1b127b15
Contents?: true
Size: 1.15 KB
Versions: 7
Compression:
Stored size: 1.15 KB
Contents
module Sufia module Admin class PermissionTemplatesController < ApplicationController before_action :load_template_for_admin_set def update authorize! :update, @permission_template Forms::PermissionTemplateForm.new(@permission_template).update(update_params) # Ensure we redirect to active tab current_tab = params[:sufia_permission_template][:access_grants_attributes].present? ? 'participants' : 'visibility' redirect_to sufia.edit_admin_admin_set_path(params[:admin_set_id], anchor: current_tab), notice: 'Permissions updated' end private # This sets the @permission_template so that CanCanCan doesn't have to. def load_template_for_admin_set @permission_template = Sufia::PermissionTemplate.find_by(admin_set_id: params[:admin_set_id]) end def update_params params.require(:sufia_permission_template) .permit(:release_date, :release_period, :release_varies, :release_embargo, :visibility, access_grants_attributes: [:access, :agent_id, :agent_type, :id]) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems