dawarich/app/controllers/application_controller.rb

18 lines
327 B
Ruby
Raw Normal View History

# frozen_string_literal: true
class ApplicationController < ActionController::Base
2023-02-03 09:42:56 -05:00
include Pundit::Authorization
protected
def authenticate_api_key
return head :unauthorized unless current_api_user
true
end
def current_api_user
@current_api_user ||= User.find_by(api_key: params[:api_key])
end
end