8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'app/controllers/concerns/permitify.rb', line 8
def require_permission!
return false unless current_admin
return true if current_admin_is_updating_profile?
unless current_admin.permitted_to?(params)
respond_to do |format|
format.html { redirect_to polymorphic_path([:admin, :root]), alert: t('flash.unpermitted') }
format.xml { head :ok }
format.js do
flash.now[:alert] = t('flash.unpermitted')
render js: "window.location = '#{polymorphic_path([:admin, :root])}'"
end
end
return false
end
end
|