17 lines
977 B
SQL
17 lines
977 B
SQL
-- Right to REGISTER A TURN (تسجيل دور) from the permits list (ارساليات التموين): action key grains.permits.create.
|
|
-- Run on a database where GRAINS_SCREEN_PERMISSIONS already exists. Safe to re-run. Not executed by the application.
|
|
-- SU is never stored: it always has every right. Granted here: GOO. Add a row per role to grant it to more roles; delete the
|
|
-- row to take it away (the API applies it within about a minute, the user's browser on the next reload or sign-in).
|
|
|
|
INSERT INTO GRAINS_SCREEN_PERMISSIONS (ROLECODE, RESOURCE_KEY)
|
|
SELECT v.rolecode, v.resource_key
|
|
FROM (SELECT 'GOO' AS rolecode, 'grains.permits.create' AS resource_key FROM dual) v
|
|
WHERE NOT EXISTS (
|
|
SELECT 1 FROM GRAINS_SCREEN_PERMISSIONS p
|
|
WHERE p.rolecode = v.rolecode AND p.resource_key = v.resource_key);
|
|
|
|
COMMIT;
|
|
|
|
-- Check (expect 1 row):
|
|
-- SELECT rolecode, resource_key FROM GRAINS_SCREEN_PERMISSIONS WHERE resource_key = 'grains.permits.create';
|