This repository was archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 214
class ShopifyCli::Shopifolk
Melanie Wang edited this page Jan 28, 2021
·
1 revision
ShopifyCli::Shopifolk contains the logic to determine if the user appears to be a Shopify staff
The Shopifolk Feature flag will persist between runs so if the flag is enabled or disabled, it will still be in that same state until the next class invocation.
GCLOUD_CONFIG_FILEDEV_PATHSECTIONFEATURE_NAME
acting_as_shopify_organization
check()
will return if the user appears to be a Shopify employee, based on several
heuristics
-
is_shopifolk- returns true if the user is a Shopify Employee
ShopifyCli::Shopifolk.check
see source
# File lib/shopify-cli/shopifolk.rb, line 27
def check
return false unless ShopifyCli::Config.get_bool('shopifolk-beta', 'enabled')
ShopifyCli::Shopifolk.new.shopifolk?
endact_as_shopify_organization()
see source
# File lib/shopify-cli/shopifolk.rb, line 33
def act_as_shopify_organization
@acting_as_shopify_organization = true
endacting_as_shopify_organization?()
see source
# File lib/shopify-cli/shopifolk.rb, line 37
def acting_as_shopify_organization?
!!@acting_as_shopify_organization || (Project.has_current? && Project.current.config['shopify_organization'])
endreset()
see source
# File lib/shopify-cli/shopifolk.rb, line 41
def reset
@acting_as_shopify_organization = nil
endshopifolk?()
will return if the user is a Shopify employee
-
is_shopifolk- returns true if the user hasdevinstalled and
a valid google cloud config file with email ending in "@shopify.com"
see source
# File lib/shopify-cli/shopifolk.rb, line 54
def shopifolk?
return false unless ShopifyCli::Config.get_bool('shopifolk-beta', 'enabled')
return true if Feature.enabled?(FEATURE_NAME)
if shopifolk_by_gcloud? && shopifolk_by_dev?
ShopifyCli::Feature.enable(FEATURE_NAME)
true
else
ShopifyCli::Feature.disable(FEATURE_NAME)
false
end
end