Files
shopdb-flask/plugins/computers/policyflag.py
benjamin.baker 01734e5449 harden CSV import reconciliation and preserve saved model selections
Default fuzzy reconcile threshold to 0 and refuse merges when digit runs differ so numbered labels like Bay 311 never bind to Bay 310. Keep edit forms from clearing saved model fields when category filtering hides untyped rows. Includes in-progress computers policy and endpoints command feature work.
2026-08-28 09:29:09 -04:00

20 lines
823 B
Python

"""Single source of truth for the Configuration/Business Policy feature gate.
Kept in its own module (not on the plugin class) so the CRUD routes, the panel
surface, and the endpoints enforcement path can all consult the same switch
without importing ComputersPlugin. The flag is the computers_configpolicies_enabled
Setting row seeded by the plugin's get_settings_defaults; while it is off, every
policy code path no-ops, which is the exit gate for rolling the feature back.
"""
def policy_flag_enabled():
"""True when computers_configpolicies_enabled is set truthy."""
from shopdb.api import Setting
setting = Setting.query.filter_by(
key='computers_configpolicies_enabled').first()
if not setting:
return False
return (setting.value or '').strip().lower() in ('true', '1', 'yes')