mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-25 20:46:48 +00:00
We still need to iterate on its implementation and it's too early to make it publicly available.
29 lines
524 B
Ruby
29 lines
524 B
Ruby
# Tells whether a particular feature is enabled or not
|
|
class FeatureFlags
|
|
# Constructor
|
|
#
|
|
# @param user [User]
|
|
def initialize(user)
|
|
@user = user
|
|
end
|
|
|
|
# Checks whether product import is enabled for the specified user
|
|
#
|
|
# @return [Boolean]
|
|
def product_import_enabled?
|
|
superadmin?
|
|
end
|
|
|
|
private
|
|
|
|
attr_reader :user
|
|
|
|
# Checks whether the specified user is a superadmin, with full control of the
|
|
# instance
|
|
#
|
|
# @return [Boolean]
|
|
def superadmin?
|
|
user.has_spree_role?('admin')
|
|
end
|
|
end
|