Module: Smriti::Admin::AuthBridge
- Extended by:
- ActiveSupport::Concern
- Included in:
- ApplicationController
- Defined in:
- lib/smriti/admin/auth_bridge.rb
Overview
Smriti::Admin::AuthBridge
Bridge module that wires the Smriti admin engine to a host-provided authentication/authorization layer, while providing safe defaults.
How it works
- Includes DefaultAuth first (fallback, no-op/hostable).
- Then includes the host auth module returned by host_auth_module.
Because Ruby searches the most recently included module first, the host
module cleanly overrides any defaults from
DefaultAuth. - Registers a before_action
authenticate_smriti!. - Exposes helpers:
smriti_current_userand its alias #user.
Host integration options (define one of these):
- A top-level module:
# app/lib/smriti_admin.rb (or any autoloaded path) module SmritiAdmin def authenticate_smriti!; end def (*); end def smriti_current_user; end end - A namespaced module:
# app/lib/smriti/admin/host_auth.rb module Smriti module Admin module HostAuth def authenticate_smriti!; end def (*); end def smriti_current_user; end end end end
If neither module is present, a blank Module.new is included and the
defaults in DefaultAuth remain in effect.
Instance Method Summary collapse
-
#user ⇒ Object?
Convenience alias for
smriti_current_userexposed to views.
Instance Method Details
#user ⇒ Object?
Convenience alias for smriti_current_user exposed to views.
68 |
# File 'lib/smriti/admin/auth_bridge.rb', line 68 def user = smriti_current_user |