Remove legacy features support
This commit is contained in:
parent
47323ffbf1
commit
d9dbf7b7f9
2 changed files with 1 additions and 26 deletions
|
@ -11,29 +11,12 @@ module Flipflop::Strategies
|
||||||
def enabled?(feature)
|
def enabled?(feature)
|
||||||
# Can only check features if we have the user's session.
|
# Can only check features if we have the user's session.
|
||||||
if request?
|
if request?
|
||||||
legacy_enabled?(feature) || find_current_administrateur&.feature_enabled?(feature)
|
find_current_administrateur&.feature_enabled?(feature)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def legacy_enabled?(feature)
|
|
||||||
if self.class.legacy_features_map.present?
|
|
||||||
ids = self.class.legacy_features_map["#{feature}_allowed_for_admin_ids"]
|
|
||||||
ids.present? && find_current_administrateur&.id&.in?(ids)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
LEGACY_CONFIG_FILE = Rails.root.join("config", "initializers", "features.yml")
|
|
||||||
|
|
||||||
def self.legacy_features_map
|
|
||||||
@@legacy_features_map = begin
|
|
||||||
if File.exist?(LEGACY_CONFIG_FILE)
|
|
||||||
YAML.load_file(LEGACY_CONFIG_FILE)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def find_current_administrateur
|
def find_current_administrateur
|
||||||
if request.session["warden.user.administrateur.key"]
|
if request.session["warden.user.administrateur.key"]
|
||||||
administrateur_id = request.session["warden.user.administrateur.key"][0][0]
|
administrateur_id = request.session["warden.user.administrateur.key"][0][0]
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
remote_storage: false
|
|
||||||
weekly_overview: false
|
|
||||||
champ_pj_allowed_for_admin_ids:
|
|
||||||
- 0
|
|
||||||
champ_siret_allowed_for_admin_ids:
|
|
||||||
- 0
|
|
||||||
web_hook_allowed_for_admin_ids:
|
|
||||||
- 0
|
|
Loading…
Add table
Reference in a new issue