35 lines
2.3 KiB
SQL
35 lines
2.3 KiB
SQL
-- Registry Excel export rights (NAFITHTCS schema): who sees the "تصدير Excel" button of the trucks, trailers and drivers lists.
|
|
-- The application has NO role list for this: only these rows decide (SU always may). Safe to re-run: a row is only inserted
|
|
-- when it is not there yet. Not executed by the application.
|
|
--
|
|
-- Starting values copy the legacy screens (truckGrid.cfm / driverGrid.cfm):
|
|
-- trucks, trailers : GTO, GOO, GNAC (+ CO, which has the same rights as GTO)
|
|
-- drivers : GTO, GOO (+ CO)
|
|
--
|
|
-- To take a right away, delete the row; the API applies it within about a minute (permissions are cached per role for 60 seconds)
|
|
-- and the user's browser picks it up on the next page reload or sign-in.
|
|
|
|
INSERT INTO GRAINS_SCREEN_PERMISSIONS (ROLECODE, RESOURCE_KEY)
|
|
SELECT v.rolecode, v.resource_key
|
|
FROM (
|
|
SELECT 'GTO' AS rolecode, 'grains.registry.trucks.export' AS resource_key FROM dual UNION ALL
|
|
SELECT 'GOO', 'grains.registry.trucks.export' FROM dual UNION ALL
|
|
SELECT 'GNAC', 'grains.registry.trucks.export' FROM dual UNION ALL
|
|
SELECT 'CO', 'grains.registry.trucks.export' FROM dual UNION ALL
|
|
SELECT 'GTO', 'grains.registry.trailers.export' FROM dual UNION ALL
|
|
SELECT 'GOO', 'grains.registry.trailers.export' FROM dual UNION ALL
|
|
SELECT 'GNAC', 'grains.registry.trailers.export' FROM dual UNION ALL
|
|
SELECT 'CO', 'grains.registry.trailers.export' FROM dual UNION ALL
|
|
SELECT 'GTO', 'grains.registry.drivers.export' FROM dual UNION ALL
|
|
SELECT 'GOO', 'grains.registry.drivers.export' FROM dual UNION ALL
|
|
SELECT 'CO', 'grains.registry.drivers.export' 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 11 rows):
|
|
-- SELECT rolecode, resource_key FROM GRAINS_SCREEN_PERMISSIONS WHERE resource_key LIKE 'grains.registry.%.export' ORDER BY 2, 1;
|