fix: exempt admins from default user group limits

This commit is contained in:
fawney19
2026-05-11 18:20:01 +08:00
parent 9bed5e9f83
commit fed676f54f
19 changed files with 264 additions and 20 deletions

View File

@@ -97,4 +97,5 @@ VALUES (
INSERT OR IGNORE INTO user_group_members (group_id, user_id, created_at)
SELECT '00000000-0000-0000-0000-000000000001', id, CAST(strftime('%s', 'now') AS INTEGER)
FROM users
WHERE is_deleted = 0;
WHERE is_deleted = 0
AND LOWER(role) <> 'admin';

View File

@@ -0,0 +1,14 @@
DELETE FROM user_group_members
WHERE user_id IN (
SELECT id
FROM users
WHERE LOWER(role) = 'admin'
)
AND (
group_id = '00000000-0000-0000-0000-000000000001'
OR group_id IN (
SELECT TRIM(value, '"')
FROM system_configs
WHERE key = 'default_user_group_id'
)
);