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
expects: context.identity_type context.sub context.tenant_id (optional).
- #load_user ⇒ Object
Instance Method Details
#call ⇒ Object
expects:
context.identity_type
context.sub
context.tenant_id (optional)
8 9 10 11 12 13 14 15 |
# File 'app/interactors/spree_cm_commissioner/user_identity_checker.rb', line 8 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
17 18 19 20 21 22 23 24 25 26 |
# File 'app/interactors/spree_cm_commissioner/user_identity_checker.rb', line 17 def load_user return if context.sub.blank? || context.identity_type.blank? user_identity_provider = UserIdentityProvider.joins(:user) .where(identity_type: context.identity_type, sub: context.sub) .where(spree_users: { tenant_id: context.tenant_id }) .first context.user = user_identity_provider&.user end |