fix: missing permissions and optional update (#18735)

* fix: missing permissions

* fix: test
This commit is contained in:
Daimolean 2025-05-29 21:48:44 +08:00 committed by GitHub
parent 10181defb1
commit 6f39a706b2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 13 additions and 9 deletions

Binary file not shown.

View file

@ -8335,10 +8335,6 @@
"type": "array"
}
},
"required": [
"name",
"permissions"
],
"type": "object"
},
"ActivityCreateDto": {

View file

@ -415,8 +415,8 @@ export type ApiKeyCreateResponseDto = {
secret: string;
};
export type ApiKeyUpdateDto = {
name: string;
permissions: Permission[];
name?: string;
permissions?: Permission[];
};
export type AssetBulkDeleteDto = {
force?: boolean;

View file

@ -15,14 +15,16 @@ export class APIKeyCreateDto {
}
export class APIKeyUpdateDto {
@Optional()
@IsString()
@IsNotEmpty()
name!: string;
name?: string;
@Optional()
@IsEnum(Permission, { each: true })
@ApiProperty({ enum: Permission, enumName: 'Permission', isArray: true })
@ArrayMinSize(1)
permissions!: Permission[];
permissions?: Permission[];
}
export class APIKeyCreateResponseDto {

View file

@ -110,7 +110,13 @@
Permission.PersonReassign,
]);
permissions.set('session', [Permission.SessionRead, Permission.SessionUpdate, Permission.SessionDelete]);
permissions.set('session', [
Permission.SessionCreate,
Permission.SessionRead,
Permission.SessionUpdate,
Permission.SessionDelete,
Permission.SessionLock,
]);
permissions.set('sharedLink', [
Permission.SharedLinkCreate,