Files
openfoodnetwork/app/models/feature_flags.rb
Pau Perez 78e59d059a Show product import's UI only to superadmins
We still need to iterate on its implementation and it's too early to
make it publicly available.
2018-06-11 19:50:53 +02:00

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