refactor(auth): simplify authorization checks to use membership only
- Remove explicit ADMIN role checks in API handlers - Replace combined creator/member role checks with membership-only filters - Update seed data roles to reflect changed authorization logic - Add migration to insert hunt creators as members for consistent checks - Prevent removal of hunt creator as a member with new explicit check - Adjust related user role updates and queries accordingly - Upgrade dependencies including nuxt and zod for compatibility
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
-- Add hunt creators as HuntMembers so authorization only needs membership check
|
||||
INSERT INTO "HuntMember" ("huntId", "memberId", "createdAt")
|
||||
SELECT h."id", h."creatorId", NOW()
|
||||
FROM "Hunt" h
|
||||
WHERE NOT EXISTS (
|
||||
SELECT 1 FROM "HuntMember" hm
|
||||
WHERE hm."huntId" = h."id" AND hm."memberId" = h."creatorId"
|
||||
);
|
||||
Reference in New Issue
Block a user