This repository has been archived by the owner on Jun 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 201
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_FILE
DEV_PATH
SECTION
FEATURE_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?
end
act_as_shopify_organization()
see source
# File lib/shopify-cli/shopifolk.rb, line 33
def act_as_shopify_organization
@acting_as_shopify_organization = true
end
acting_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'])
end
reset()
see source
# File lib/shopify-cli/shopifolk.rb, line 41
def reset
@acting_as_shopify_organization = nil
end
shopifolk?()
will return if the user is a Shopify employee
-
is_shopifolk
- returns true if the user hasdev
installed 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