Sha256: f80fb475f7fee6db2145304cb010b74b2b46bf14ae66c8e2567f89261ffc4aa8
Contents?: true
Size: 1.41 KB
Versions: 5
Compression:
Stored size: 1.41 KB
Contents
# frozen_string_literal: true module ShopifyApp module AccessScopes class UserStrategy class << self def update_access_scopes?(user_id: nil, shopify_user_id: nil) return update_access_scopes_for_user_id?(user_id) if user_id return update_access_scopes_for_shopify_user_id?(shopify_user_id) if shopify_user_id raise(::ShopifyApp::InvalidInput, "#update_access_scopes? requires user_id or shopify_user_id parameter inputs") end private def update_access_scopes_for_user_id?(user_id) user_access_scopes = user_access_scopes_by_user_id(user_id) configuration_access_scopes != user_access_scopes end def update_access_scopes_for_shopify_user_id?(shopify_user_id) user_access_scopes = user_access_scopes_by_shopify_user_id(shopify_user_id) configuration_access_scopes != user_access_scopes end def user_access_scopes_by_user_id(user_id) ShopifyApp::SessionRepository.retrieve_user_session(user_id)&.scope end def user_access_scopes_by_shopify_user_id(shopify_user_id) ShopifyApp::SessionRepository.retrieve_user_session_by_shopify_user_id(shopify_user_id)&.scope end def configuration_access_scopes ShopifyAPI::Auth::AuthScopes.new(ShopifyApp.configuration.user_access_scopes) end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems