NTP_V2/db/disabled-features.sql

29 lines
1.5 KiB
SQL

-- Features switched OFF for EVERYBODY, SU included (NAFITHTCS schema). Run once on a database where GRAINS_SCREEN_PERMISSIONS exists.
-- Safe to re-run: a row is only inserted when it is not there yet. Not executed by the application.
--
-- A row with ROLECODE = 'DISABLED' takes the resource out of the system for all users: its menu entry and buttons disappear and
-- the API answers 403 for it. It overrides every other row and the SU rule. To bring a feature back, DELETE its row; the change
-- reaches the API within about a minute and a user's browser on the next page reload or sign-in.
--
-- grains.permits.absence إيقاف/تفعيل الاستنكاف (stop / activate the absence feature)
-- grains.permits.activation تفعيل الطلبية (order activation screen)
INSERT INTO GRAINS_SCREEN_PERMISSIONS (ROLECODE, RESOURCE_KEY)
SELECT 'DISABLED', v.resource_key
FROM (
SELECT 'grains.permits.absence' AS resource_key FROM dual UNION ALL
SELECT 'grains.permits.activation' FROM dual
) v
WHERE NOT EXISTS (
SELECT 1 FROM GRAINS_SCREEN_PERMISSIONS p
WHERE p.rolecode = 'DISABLED' AND p.resource_key = v.resource_key);
COMMIT;
-- Check (expect 2 rows):
-- SELECT rolecode, resource_key FROM GRAINS_SCREEN_PERMISSIONS WHERE rolecode = 'DISABLED' ORDER BY 2;
--
-- Bring one back:
-- DELETE FROM GRAINS_SCREEN_PERMISSIONS WHERE rolecode = 'DISABLED' AND resource_key = 'grains.permits.absence';
-- COMMIT;