cartodb-4.29/app/constraints/carto/feature_flag_constraint.rb

14 lines
379 B
Ruby
Raw Normal View History

2020-06-15 10:58:47 +08:00
# TODO: this is not used for the moment because it should be used in routes file but it breaks reloading.
class Carto::FeatureFlagConstraint
def initialize(feature_flag)
@feature_flag = feature_flag
end
def matches?(request)
user = Carto::User.where(username: CartoDB.extract_subdomain(request)).first
user && user.has_feature_flag?(@feature_flag)
end
end