-- Grant HR group access to Payroll module
-- Date: 2025-11-18
-- Description: Add Payroll module permission for HR group

-- Grant HR group access to Payroll module
INSERT INTO group_module_permissions (group_id, module_id, action) 
VALUES ('0194a8ba-0000-7123-8123-123456789ad1'::uuid, '018e3f0a-12d3-7c45-b89a-2f3c4e1d5b6c'::uuid, 'allow')
ON CONFLICT DO NOTHING;

-- Verify the permission was granted
SELECT 
    g.name as group_name,
    m.name as module_name,
    m.module_id,
    gmp.action
FROM group_module_permissions gmp
JOIN groups g ON g.group_id = gmp.group_id
JOIN modules m ON m.module_id = gmp.module_id
WHERE g.group_id = '0194a8ba-0000-7123-8123-123456789ad1'::uuid
  AND m.module_id = '018e3f0a-12d3-7c45-b89a-2f3c4e1d5b6c'::uuid;
