This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2017-11-11 20:23:33 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Admin
|
|
|
|
class RolesController < BaseController
|
|
|
|
before_action :set_user
|
|
|
|
|
|
|
|
def promote
|
|
|
|
authorize @user, :promote?
|
|
|
|
@user.promote!
|
2017-11-24 02:05:53 +01:00
|
|
|
log_action :promote, @user
|
2017-11-11 20:23:33 +01:00
|
|
|
redirect_to admin_account_path(@user.account_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
def demote
|
|
|
|
authorize @user, :demote?
|
|
|
|
@user.demote!
|
2017-11-24 02:05:53 +01:00
|
|
|
log_action :demote, @user
|
2017-11-11 20:23:33 +01:00
|
|
|
redirect_to admin_account_path(@user.account_id)
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def set_user
|
|
|
|
@user = Account.find(params[:account_id]).user || raise(ActiveRecord::RecordNotFound)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|