1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/controllers/settings/roles_controller.rb

31 lines
589 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class Settings::RolesController < ApplicationController
before_action :set_role, except: :index
# GET /settings/roles
def index
authorize %i[settings role]
@roles = policy_scope(
current_account.roles,
policy_scope_class: Settings::RolePolicy::Scope,
)
end
# DELETE /settings/roles/:id
def destroy
authorize [:settings, @role]
current_account.remove_role @role.name, @role.resource
redirect_to settings_roles_url
end
private
def set_role
@role = current_account.roles.find params[:id]
end
end