chore: DRY up check_authorization method (#1351)

This commit is contained in:
Ronald Walker
2020-10-20 19:22:21 +05:30
committed by GitHub
parent bbef03edea
commit cbe9e06472
7 changed files with 7 additions and 21 deletions
+6
View File
@@ -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