mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-03 04:27:53 +00:00
chore: DRY up check_authorization method (#1351)
This commit is contained in:
@@ -10,4 +10,10 @@ class Api::BaseController < ApplicationController
|
||||
def authenticate_by_access_token?
|
||||
request.headers[:api_access_token].present? || request.headers[:HTTP_API_ACCESS_TOKEN].present?
|
||||
end
|
||||
|
||||
def check_authorization(model = nil)
|
||||
model ||= controller_name.classify.constantize
|
||||
|
||||
authorize(model)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user