feat: update application version to 0.8.20 and enhance superadmin role management
- Bumped application version to 0.8.20 in both backend and frontend files. - Introduced migration 041 to promote the oldest admin user to superadmin if no superadmin exists. - Updated registration logic to assign the superadmin role to the first user and those in ADMIN_BOOTSTRAP_EMAILS. - Enhanced changelog to document the new version and changes made in this release.
This commit is contained in:
1 parent
9afcd762d0
commit
b661d0edb2
4 files changed
+37
-8
No files matched your search
@@ -0,0 +1,20 @@
|
||||
-- Migration 041: Super-Admin für bestehende Installationen
|
||||
-- Bisheriger Bootstrap (registration_role) setzte nur 'admin'. Viele Endpunkte
|
||||
-- (z. B. Verein löschen, Super-Rolle vergeben) verlangen 'superadmin'.
|
||||
-- Wenn noch kein Super-Admin existiert: den ältesten Nutzer mit role = admin hochstufen.
|
||||
|
||||
UPDATE profiles p
|
||||
SET role = 'superadmin', updated_at = NOW()
|
||||
FROM (
|
||||
SELECT id
|
||||
FROM profiles
|
||||
WHERE lower(trim(COALESCE(role, ''))) = 'admin'
|
||||
ORDER BY id ASC
|
||||
LIMIT 1
|
||||
) sub
|
||||
WHERE p.id = sub.id
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM profiles
|
||||
WHERE lower(trim(COALESCE(role, ''))) = 'superadmin'
|
||||
);
|
||||
Reference in new issue
Block a user