Class: SpreeCmCommissioner::UserIdentityChecker
- Inherits:
-
BaseInteractor
- Object
- BaseInteractor
- SpreeCmCommissioner::UserIdentityChecker
- Defined in:
- app/interactors/spree_cm_commissioner/user_identity_checker.rb
Instance Method Summary collapse
-
#call ⇒ Object
:identity_type, :sub.
- #load_user ⇒ Object
Instance Method Details
#call ⇒ Object
:identity_type, :sub
4 5 6 7 8 9 10 11 |
# File 'app/interactors/spree_cm_commissioner/user_identity_checker.rb', line 4 def call load_user return unless context.user.nil? = I18n.t('user_identity_provider.not_found', identity_type: context.identity_type) context.fail!(message: ) end |
#load_user ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/interactors/spree_cm_commissioner/user_identity_checker.rb', line 13 def load_user user_identity_provider = UserIdentityProvider.where( identity_type: context.identity_type, sub: context.sub ).first context.user = (user_identity_provider.user if user_identity_provider.present?) end |