"""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')