mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 13:05:32 +09:00
fix(schema): allow assigning every admin ACL to a user (#1797)
This commit is contained in:
1 parent
2c8b3ff45c
commit
ba96f52ed6
2 files changed
+24
-2
No files matched your search
@@ -8,6 +8,7 @@ import {
|
||||
UserFlags,
|
||||
UserFlagsDescriptions,
|
||||
} from '@fluxer/constants/src/UserConstants';
|
||||
import {AdminACLs} from '@fluxer/constants/src/AdminACLs';
|
||||
import {NSFWLevelSchema} from '@fluxer/schema/src/primitives/GuildValidators';
|
||||
import {
|
||||
createBitflagInt32Type,
|
||||
@@ -21,6 +22,8 @@ import {
|
||||
import {DiscriminatorType, EmailType, UsernameType} from '@fluxer/schema/src/primitives/UserValidators';
|
||||
import {z} from 'zod';
|
||||
|
||||
const ADMIN_ACL_COUNT = Object.keys(AdminACLs).length;
|
||||
|
||||
export const UserAdminResponseSchema = z.object({
|
||||
id: SnowflakeStringType,
|
||||
username: z.string(),
|
||||
@@ -65,7 +68,7 @@ export const UserAdminResponseSchema = z.object({
|
||||
pending_bulk_message_deletion_at: z.string().nullable(),
|
||||
deletion_reason_code: Int32Type.nullable(),
|
||||
deletion_public_reason: z.string().nullable(),
|
||||
acls: z.array(z.string()).max(100),
|
||||
acls: z.array(z.string()).max(ADMIN_ACL_COUNT),
|
||||
traits: z.array(z.string()).max(100),
|
||||
has_totp: z.boolean(),
|
||||
authenticator_types: z.array(Int32Type).max(10),
|
||||
@@ -353,7 +356,7 @@ export type ScheduleAccountDeletionRequest = z.infer<typeof ScheduleAccountDelet
|
||||
|
||||
export const SetUserAclsRequest = z.object({
|
||||
user_id: SnowflakeType.describe('ID of the user to set ACLs for'),
|
||||
acls: z.array(createStringType(1, 64)).max(100).describe('List of access control permissions to assign'),
|
||||
acls: z.array(createStringType(1, 64)).max(ADMIN_ACL_COUNT).describe('List of access control permissions to assign'),
|
||||
});
|
||||
|
||||
export type SetUserAclsRequest = z.infer<typeof SetUserAclsRequest>;
|
||||
|
||||
Reference in new issue
Block a user