shopify_app 13.0.0 → 18.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -0
- data/.github/ISSUE_TEMPLATE/bug-report.md +63 -0
- data/.github/ISSUE_TEMPLATE/config.yml +1 -0
- data/.github/ISSUE_TEMPLATE/feature-request.md +33 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +22 -0
- data/.github/workflows/build.yml +41 -0
- data/.github/workflows/release.yml +24 -0
- data/.github/workflows/rubocop.yml +22 -0
- data/.gitignore +0 -2
- data/.rubocop.yml +14 -6
- data/CHANGELOG.md +158 -0
- data/CONTRIBUTING.md +76 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +268 -0
- data/README.md +73 -534
- data/Rakefile +1 -0
- data/SECURITY.md +59 -0
- data/app/assets/images/storage_access.svg +1 -2
- data/app/assets/javascripts/shopify_app/post_redirect.js +9 -0
- data/app/assets/javascripts/shopify_app/storage_access.js +2 -1
- data/app/assets/javascripts/shopify_app/top_level_interaction.js +1 -1
- data/app/controllers/concerns/shopify_app/authenticated.rb +1 -0
- data/app/controllers/concerns/shopify_app/ensure_authenticated_links.rb +26 -0
- data/app/controllers/concerns/shopify_app/require_known_shop.rb +39 -0
- data/app/controllers/concerns/shopify_app/shop_access_scopes_verification.rb +32 -0
- data/app/controllers/shopify_app/authenticated_controller.rb +1 -0
- data/app/controllers/shopify_app/callback_controller.rb +104 -18
- data/app/controllers/shopify_app/extension_verification_controller.rb +2 -7
- data/app/controllers/shopify_app/sessions_controller.rb +26 -10
- data/app/controllers/shopify_app/webhooks_controller.rb +6 -5
- data/app/views/shopify_app/partials/_button_styles.html.erb +41 -36
- data/app/views/shopify_app/partials/_card_styles.html.erb +3 -3
- data/app/views/shopify_app/partials/_empty_state_styles.html.erb +28 -59
- data/app/views/shopify_app/partials/_form_styles.html.erb +56 -0
- data/app/views/shopify_app/partials/_layout_styles.html.erb +16 -1
- data/app/views/shopify_app/partials/_typography_styles.html.erb +6 -6
- data/app/views/shopify_app/sessions/enable_cookies.html.erb +2 -7
- data/app/views/shopify_app/sessions/new.html.erb +38 -110
- data/app/views/shopify_app/sessions/request_storage_access.html.erb +1 -1
- data/app/views/shopify_app/sessions/top_level_interaction.html.erb +21 -22
- data/app/views/shopify_app/shared/post_redirect_to_auth_shopify.html.erb +13 -0
- data/config/locales/de.yml +11 -11
- data/config/locales/fi.yml +1 -1
- data/config/locales/nl.yml +8 -8
- data/config/locales/th.yml +4 -4
- data/config/locales/vi.yml +22 -0
- data/config/locales/zh-CN.yml +1 -1
- data/config/routes.rb +1 -0
- data/docs/Quickstart.md +15 -87
- data/docs/Releasing.md +18 -14
- data/docs/Troubleshooting.md +147 -4
- data/docs/Upgrading.md +126 -0
- data/docs/shopify_app/authentication.md +124 -0
- data/docs/shopify_app/engine.md +82 -0
- data/docs/shopify_app/generators.md +127 -0
- data/docs/shopify_app/handling-access-scopes-changes.md +14 -0
- data/docs/shopify_app/script-tags.md +28 -0
- data/docs/shopify_app/session-repository.md +88 -0
- data/docs/shopify_app/testing.md +38 -0
- data/docs/shopify_app/webhooks.md +72 -0
- data/karma.conf.js +1 -1
- data/lib/generators/shopify_app/add_after_authenticate_job/add_after_authenticate_job_generator.rb +5 -3
- data/lib/generators/shopify_app/add_after_authenticate_job/templates/after_authenticate_job.rb +1 -0
- data/lib/generators/shopify_app/add_marketing_activity_extension/add_marketing_activity_extension_generator.rb +2 -1
- data/lib/generators/shopify_app/add_marketing_activity_extension/templates/marketing_activities_controller.rb +4 -4
- data/lib/generators/shopify_app/add_webhook/add_webhook_generator.rb +5 -4
- data/lib/generators/shopify_app/add_webhook/templates/{webhook_job.rb → webhook_job.rb.tt} +5 -0
- data/lib/generators/shopify_app/app_proxy_controller/app_proxy_controller_generator.rb +4 -3
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_controller.rb +3 -3
- data/lib/generators/shopify_app/app_proxy_controller/templates/app_proxy_route.rb +10 -9
- data/lib/generators/shopify_app/authenticated_controller/authenticated_controller_generator.rb +1 -1
- data/lib/generators/shopify_app/controllers/controllers_generator.rb +2 -1
- data/lib/generators/shopify_app/home_controller/home_controller_generator.rb +31 -3
- data/lib/generators/shopify_app/home_controller/templates/home_controller.rb +10 -0
- data/lib/generators/shopify_app/home_controller/templates/index.html.erb +66 -16
- data/lib/generators/shopify_app/home_controller/templates/unauthenticated_home_controller.rb +12 -0
- data/lib/generators/shopify_app/install/install_generator.rb +46 -11
- data/lib/generators/shopify_app/install/templates/embedded_app.html.erb +3 -2
- data/lib/generators/shopify_app/install/templates/flash_messages.js +0 -2
- data/lib/generators/shopify_app/install/templates/omniauth.rb +3 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.js +1 -1
- data/lib/generators/shopify_app/install/templates/shopify_app.rb.tt +25 -0
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb.tt +8 -0
- data/lib/generators/shopify_app/install/templates/user_agent.rb +2 -1
- data/lib/generators/shopify_app/products_controller/products_controller_generator.rb +19 -0
- data/lib/generators/shopify_app/products_controller/templates/products_controller.rb +8 -0
- data/lib/generators/shopify_app/routes/routes_generator.rb +1 -0
- data/lib/generators/shopify_app/routes/templates/routes.rb +10 -9
- data/lib/generators/shopify_app/shop_model/shop_model_generator.rb +39 -7
- data/lib/generators/shopify_app/shop_model/templates/db/migrate/add_shop_access_scopes_column.erb +5 -0
- data/lib/generators/shopify_app/shop_model/templates/shop.rb +2 -1
- data/lib/generators/shopify_app/shopify_app_generator.rb +4 -3
- data/lib/generators/shopify_app/user_model/templates/db/migrate/add_user_access_scopes_column.erb +5 -0
- data/lib/generators/shopify_app/user_model/templates/user.rb +2 -1
- data/lib/generators/shopify_app/user_model/user_model_generator.rb +39 -7
- data/lib/generators/shopify_app/views/views_generator.rb +2 -1
- data/lib/shopify_app/access_scopes/noop_strategy.rb +13 -0
- data/lib/shopify_app/access_scopes/shop_strategy.rb +24 -0
- data/lib/shopify_app/access_scopes/user_strategy.rb +41 -0
- data/lib/shopify_app/configuration.rb +40 -8
- data/lib/shopify_app/controller_concerns/app_proxy_verification.rb +3 -3
- data/lib/shopify_app/controller_concerns/csrf_protection.rb +15 -0
- data/lib/shopify_app/controller_concerns/embedded_app.rb +3 -2
- data/lib/shopify_app/controller_concerns/localization.rb +1 -0
- data/lib/shopify_app/controller_concerns/login_protection.rb +81 -16
- data/lib/shopify_app/controller_concerns/payload_verification.rb +24 -0
- data/lib/shopify_app/controller_concerns/webhook_verification.rb +3 -18
- data/lib/shopify_app/engine.rb +27 -0
- data/lib/shopify_app/jobs/scripttags_manager_job.rb +1 -1
- data/lib/shopify_app/jobs/webhooks_manager_job.rb +1 -1
- data/lib/shopify_app/managers/scripttags_manager.rb +4 -3
- data/lib/shopify_app/managers/webhooks_manager.rb +4 -3
- data/lib/shopify_app/middleware/jwt_middleware.rb +42 -0
- data/lib/shopify_app/middleware/same_site_cookie_middleware.rb +3 -2
- data/lib/shopify_app/omniauth/omniauth_configuration.rb +64 -0
- data/lib/shopify_app/session/in_memory_session_store.rb +7 -3
- data/lib/shopify_app/session/in_memory_shop_session_store.rb +12 -0
- data/lib/shopify_app/session/in_memory_user_session_store.rb +12 -0
- data/lib/shopify_app/session/jwt.rb +63 -0
- data/lib/shopify_app/session/null_user_session_store.rb +22 -0
- data/lib/shopify_app/session/session_repository.rb +13 -16
- data/lib/shopify_app/session/session_storage.rb +1 -0
- data/lib/shopify_app/session/shop_session_storage.rb +21 -9
- data/lib/shopify_app/session/shop_session_storage_with_scopes.rb +58 -0
- data/lib/shopify_app/session/user_session_storage.rb +19 -8
- data/lib/shopify_app/session/user_session_storage_with_scopes.rb +58 -0
- data/lib/shopify_app/test_helpers/all.rb +2 -0
- data/lib/shopify_app/test_helpers/webhook_verification_helper.rb +17 -0
- data/lib/shopify_app/utils.rb +18 -5
- data/lib/shopify_app/version.rb +2 -1
- data/lib/shopify_app.rb +23 -5
- data/package.json +7 -8
- data/service.yml +1 -4
- data/shopify_app.gemspec +15 -9
- data/translation.yml +1 -1
- data/yarn.lock +2140 -2188
- metadata +107 -19
- data/.github/ISSUE_TEMPLATE.md +0 -14
- data/.travis.yml +0 -27
- data/docs/install-on-dev-shop.png +0 -0
- data/docs/test-your-app.png +0 -0
- data/lib/generators/shopify_app/install/templates/shopify_app.rb +0 -15
- data/lib/generators/shopify_app/install/templates/shopify_provider.rb +0 -20
- data/package-lock.json +0 -7245
@@ -24,11 +24,12 @@
|
|
24
24
|
|
25
25
|
<%= render 'layouts/flash_messages' %>
|
26
26
|
|
27
|
-
<script src="https://unpkg.com/@shopify/app-bridge"></script>
|
27
|
+
<script src="https://unpkg.com/@shopify/app-bridge@2"></script>
|
28
28
|
|
29
29
|
<%= content_tag(:div, nil, id: 'shopify-app-init', data: {
|
30
30
|
api_key: ShopifyApp.configuration.api_key,
|
31
|
-
shop_origin: (@current_shopify_session.domain if @current_shopify_session),
|
31
|
+
shop_origin: @shop_origin || (@current_shopify_session.domain if @current_shopify_session),
|
32
|
+
host: @host,
|
32
33
|
debug: Rails.env.development?
|
33
34
|
} ) %>
|
34
35
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
ShopifyApp.configure do |config|
|
2
|
+
config.application_name = "<%= @application_name %>"
|
3
|
+
config.old_secret = "<%= @old_secret %>"
|
4
|
+
config.scope = "<%= @scope %>" # Consult this page for more scope options:
|
5
|
+
# https://help.shopify.com/en/api/getting-started/authentication/oauth/scopes
|
6
|
+
config.embedded_app = <%= embedded_app? %>
|
7
|
+
config.after_authenticate_job = false
|
8
|
+
config.api_version = "<%= @api_version %>"
|
9
|
+
config.shop_session_repository = 'Shop'
|
10
|
+
|
11
|
+
config.reauth_on_access_scope_changes = true
|
12
|
+
|
13
|
+
config.allow_jwt_authentication = <%= !with_cookie_authentication? %>
|
14
|
+
config.allow_cookie_authentication = <%= with_cookie_authentication? %>
|
15
|
+
|
16
|
+
config.api_key = ENV.fetch('SHOPIFY_API_KEY', '').presence
|
17
|
+
config.secret = ENV.fetch('SHOPIFY_API_SECRET', '').presence
|
18
|
+
if defined? Rails::Server
|
19
|
+
raise('Missing SHOPIFY_API_KEY. See https://github.com/Shopify/shopify_app#requirements') unless config.api_key
|
20
|
+
raise('Missing SHOPIFY_API_SECRET. See https://github.com/Shopify/shopify_app#requirements') unless config.secret
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# ShopifyApp::Utils.fetch_known_api_versions # Uncomment to fetch known api versions from shopify servers on boot
|
25
|
+
# ShopifyAPI::ApiVersion.version_lookup_mode = :raise_on_unknown # Uncomment to raise an error if attempting to use an api version that was not previously known
|
@@ -0,0 +1,8 @@
|
|
1
|
+
provider :shopify,
|
2
|
+
ShopifyApp.configuration.api_key,
|
3
|
+
ShopifyApp.configuration.secret,
|
4
|
+
scope: ShopifyApp.configuration.scope,
|
5
|
+
setup: lambda { |env|
|
6
|
+
configuration = ShopifyApp::OmniAuthConfiguration.new(env['omniauth.strategy'], Rack::Request.new(env))
|
7
|
+
configuration.build_options
|
8
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators/base'
|
4
|
+
|
5
|
+
module ShopifyApp
|
6
|
+
module Generators
|
7
|
+
class ProductsControllerGenerator < Rails::Generators::Base
|
8
|
+
source_root File.expand_path('../templates', __FILE__)
|
9
|
+
|
10
|
+
def create_products_controller
|
11
|
+
template('products_controller.rb', 'app/controllers/products_controller.rb')
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_products_route
|
15
|
+
route("get '/products', :to => 'products#index'")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -1,11 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
controller :sessions do
|
4
|
+
get 'login' => :new, :as => :login
|
5
|
+
post 'login' => :create, :as => :authenticate
|
6
|
+
get 'auth/shopify/callback' => :callback
|
7
|
+
get 'logout' => :destroy, :as => :logout
|
8
|
+
end
|
8
9
|
|
9
|
-
|
10
|
-
|
11
|
-
|
10
|
+
namespace :webhooks do
|
11
|
+
post ':type' => :receive
|
12
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rails/generators/base'
|
2
3
|
require 'rails/generators/active_record'
|
3
4
|
|
@@ -7,31 +8,62 @@ module ShopifyApp
|
|
7
8
|
include Rails::Generators::Migration
|
8
9
|
source_root File.expand_path('../templates', __FILE__)
|
9
10
|
|
11
|
+
class_option :new_shopify_cli_app, type: :boolean, default: false
|
12
|
+
|
10
13
|
def create_shop_model
|
11
|
-
copy_file
|
14
|
+
copy_file('shop.rb', 'app/models/shop.rb')
|
12
15
|
end
|
13
16
|
|
14
17
|
def create_shop_migration
|
15
|
-
migration_template
|
18
|
+
migration_template('db/migrate/create_shops.erb', 'db/migrate/create_shops.rb')
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_shop_with_access_scopes_migration
|
22
|
+
scopes_column_prompt = <<~PROMPT
|
23
|
+
It is highly recommended that apps record the access scopes granted by \
|
24
|
+
merchants during app installation. See app/models/shop.rb to modify how \
|
25
|
+
access scopes are stored and retrieved.
|
26
|
+
|
27
|
+
[WARNING] You will need to update the access_scopes accessors in the Shop model \
|
28
|
+
to allow shopify_app to store and retrieve scopes when going through OAuth.
|
29
|
+
|
30
|
+
The following migration will add an `access_scopes` column to the Shop model. \
|
31
|
+
Do you want to include this migration? [y/n]
|
32
|
+
PROMPT
|
33
|
+
|
34
|
+
if new_shopify_cli_app? || Rails.env.test? || yes?(scopes_column_prompt)
|
35
|
+
migration_template(
|
36
|
+
'db/migrate/add_shop_access_scopes_column.erb',
|
37
|
+
'db/migrate/add_shop_access_scopes_column.rb'
|
38
|
+
)
|
39
|
+
end
|
16
40
|
end
|
17
41
|
|
18
42
|
def update_shopify_app_initializer
|
19
|
-
gsub_file
|
43
|
+
gsub_file('config/initializers/shopify_app.rb', 'ShopifyApp::InMemoryShopSessionStore', 'Shop')
|
20
44
|
end
|
21
45
|
|
22
46
|
def create_shop_fixtures
|
23
|
-
copy_file
|
47
|
+
copy_file('shops.yml', 'test/fixtures/shops.yml')
|
24
48
|
end
|
25
49
|
|
26
50
|
private
|
27
51
|
|
52
|
+
def new_shopify_cli_app?
|
53
|
+
options['new_shopify_cli_app']
|
54
|
+
end
|
55
|
+
|
28
56
|
def rails_migration_version
|
29
57
|
Rails.version.match(/\d\.\d/)[0]
|
30
58
|
end
|
31
59
|
|
32
|
-
|
33
|
-
|
34
|
-
|
60
|
+
class << self
|
61
|
+
private :next_migration_number
|
62
|
+
|
63
|
+
# for generating a timestamp when using `create_migration`
|
64
|
+
def next_migration_number(dir)
|
65
|
+
ActiveRecord::Generators::Base.next_migration_number(dir)
|
66
|
+
end
|
35
67
|
end
|
36
68
|
end
|
37
69
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module ShopifyApp
|
2
3
|
module Generators
|
3
4
|
class ShopifyAppGenerator < Rails::Generators::Base
|
@@ -7,10 +8,10 @@ module ShopifyApp
|
|
7
8
|
end
|
8
9
|
|
9
10
|
def run_all_generators
|
10
|
-
generate
|
11
|
-
generate
|
11
|
+
generate("shopify_app:install #{@opts.join(' ')}")
|
12
|
+
generate("shopify_app:shop_model #{@opts.join(' ')}")
|
12
13
|
generate("shopify_app:authenticated_controller")
|
13
|
-
generate
|
14
|
+
generate("shopify_app:home_controller #{@opts.join(' ')}")
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require 'rails/generators/base'
|
2
3
|
require 'rails/generators/active_record'
|
3
4
|
|
@@ -7,31 +8,62 @@ module ShopifyApp
|
|
7
8
|
include Rails::Generators::Migration
|
8
9
|
source_root File.expand_path('../templates', __FILE__)
|
9
10
|
|
11
|
+
class_option :new_shopify_cli_app, type: :boolean, default: false
|
12
|
+
|
10
13
|
def create_user_model
|
11
|
-
copy_file
|
14
|
+
copy_file('user.rb', 'app/models/user.rb')
|
12
15
|
end
|
13
16
|
|
14
17
|
def create_user_migration
|
15
|
-
migration_template
|
18
|
+
migration_template('db/migrate/create_users.erb', 'db/migrate/create_users.rb')
|
19
|
+
end
|
20
|
+
|
21
|
+
def create_scopes_storage_in_user_model
|
22
|
+
scopes_column_prompt = <<~PROMPT
|
23
|
+
It is highly recommended that apps record the access scopes granted by \
|
24
|
+
merchants during app installation. See app/models/user.rb to modify how \
|
25
|
+
access scopes are stored and retrieved.
|
26
|
+
|
27
|
+
[WARNING] You will need to update the access_scopes accessors in the User model \
|
28
|
+
to allow shopify_app to store and retrieve scopes when going through OAuth.
|
29
|
+
|
30
|
+
The following migration will add an `access_scopes` column to the User model. \
|
31
|
+
Do you want to include this migration? [y/n]
|
32
|
+
PROMPT
|
33
|
+
|
34
|
+
if new_shopify_cli_app? || Rails.env.test? || yes?(scopes_column_prompt)
|
35
|
+
migration_template(
|
36
|
+
'db/migrate/add_user_access_scopes_column.erb',
|
37
|
+
'db/migrate/add_user_access_scopes_column.rb'
|
38
|
+
)
|
39
|
+
end
|
16
40
|
end
|
17
41
|
|
18
42
|
def update_shopify_app_initializer
|
19
|
-
gsub_file
|
43
|
+
gsub_file('config/initializers/shopify_app.rb', 'ShopifyApp::InMemoryUserSessionStore', 'User')
|
20
44
|
end
|
21
45
|
|
22
46
|
def create_user_fixtures
|
23
|
-
copy_file
|
47
|
+
copy_file('users.yml', 'test/fixtures/users.yml')
|
24
48
|
end
|
25
49
|
|
26
50
|
private
|
27
51
|
|
52
|
+
def new_shopify_cli_app?
|
53
|
+
options['new_shopify_cli_app']
|
54
|
+
end
|
55
|
+
|
28
56
|
def rails_migration_version
|
29
57
|
Rails.version.match(/\d\.\d/)[0]
|
30
58
|
end
|
31
59
|
|
32
|
-
|
33
|
-
|
34
|
-
|
60
|
+
class << self
|
61
|
+
private :next_migration_number
|
62
|
+
|
63
|
+
# for generating a timestamp when using `create_migration`
|
64
|
+
def next_migration_number(dir)
|
65
|
+
ActiveRecord::Generators::Base.next_migration_number(dir)
|
66
|
+
end
|
35
67
|
end
|
36
68
|
end
|
37
69
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module AccessScopes
|
5
|
+
class ShopStrategy
|
6
|
+
class << self
|
7
|
+
def update_access_scopes?(shop_domain)
|
8
|
+
shop_access_scopes = shop_access_scopes(shop_domain)
|
9
|
+
configuration_access_scopes != shop_access_scopes
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def shop_access_scopes(shop_domain)
|
15
|
+
ShopifyApp::SessionRepository.retrieve_shop_session_by_shopify_domain(shop_domain)&.access_scopes
|
16
|
+
end
|
17
|
+
|
18
|
+
def configuration_access_scopes
|
19
|
+
ShopifyAPI::ApiAccess.new(ShopifyApp.configuration.shop_access_scopes)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ShopifyApp
|
4
|
+
module AccessScopes
|
5
|
+
class UserStrategy
|
6
|
+
class InvalidInput < StandardError; end
|
7
|
+
|
8
|
+
class << self
|
9
|
+
def update_access_scopes?(user_id: nil, shopify_user_id: nil)
|
10
|
+
return update_access_scopes_for_user_id?(user_id) if user_id
|
11
|
+
return update_access_scopes_for_shopify_user_id?(shopify_user_id) if shopify_user_id
|
12
|
+
raise(InvalidInput, '#update_access_scopes? requires user_id or shopify_user_id parameter inputs')
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def update_access_scopes_for_user_id?(user_id)
|
18
|
+
user_access_scopes = user_access_scopes_by_user_id(user_id)
|
19
|
+
configuration_access_scopes != user_access_scopes
|
20
|
+
end
|
21
|
+
|
22
|
+
def update_access_scopes_for_shopify_user_id?(shopify_user_id)
|
23
|
+
user_access_scopes = user_access_scopes_by_shopify_user_id(shopify_user_id)
|
24
|
+
configuration_access_scopes != user_access_scopes
|
25
|
+
end
|
26
|
+
|
27
|
+
def user_access_scopes_by_user_id(user_id)
|
28
|
+
ShopifyApp::SessionRepository.retrieve_user_session(user_id)&.access_scopes
|
29
|
+
end
|
30
|
+
|
31
|
+
def user_access_scopes_by_shopify_user_id(shopify_user_id)
|
32
|
+
ShopifyApp::SessionRepository.retrieve_user_session_by_shopify_user_id(shopify_user_id)&.access_scopes
|
33
|
+
end
|
34
|
+
|
35
|
+
def configuration_access_scopes
|
36
|
+
ShopifyAPI::ApiAccess.new(ShopifyApp.configuration.user_access_scopes)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|