Permission fix
This commit is contained in:
27
add_finance_to_enum.sql
Normal file
27
add_finance_to_enum.sql
Normal file
@@ -0,0 +1,27 @@
|
||||
-- Add 'finance' value to UserRole enum type
|
||||
-- This is needed because we added a new finance role to the dynamic RBAC system
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Add the finance value to the userrole enum if it doesn't already exist
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_enum
|
||||
WHERE enumlabel = 'finance'
|
||||
AND enumtypid = (SELECT oid FROM pg_type WHERE typname = 'userrole')
|
||||
) THEN
|
||||
ALTER TYPE userrole ADD VALUE 'finance';
|
||||
RAISE NOTICE 'Added finance to userrole enum';
|
||||
ELSE
|
||||
RAISE NOTICE 'finance already exists in userrole enum';
|
||||
END IF;
|
||||
END$$;
|
||||
|
||||
COMMIT;
|
||||
|
||||
-- Verify the enum values
|
||||
SELECT enumlabel
|
||||
FROM pg_enum
|
||||
WHERE enumtypid = (SELECT oid FROM pg_type WHERE typname = 'userrole')
|
||||
ORDER BY enumsortorder;
|
||||
@@ -22,6 +22,7 @@ class UserRole(enum.Enum):
|
||||
member = "member"
|
||||
admin = "admin"
|
||||
superadmin = "superadmin"
|
||||
finance = "finance"
|
||||
|
||||
class RSVPStatus(enum.Enum):
|
||||
yes = "yes"
|
||||
|
||||
@@ -221,7 +221,7 @@ def seed_permissions():
|
||||
'member': UserRole.member,
|
||||
'admin': UserRole.admin,
|
||||
'superadmin': UserRole.superadmin,
|
||||
'finance': UserRole.admin # Finance uses admin enum for now
|
||||
'finance': UserRole.finance # Finance has its own enum value
|
||||
}
|
||||
|
||||
total_assigned = 0
|
||||
|
||||
Reference in New Issue
Block a user