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" "type": "array"
} }
}, },
"required": [
"name",
"permissions"
],
"type": "object" "type": "object"
}, },
"ActivityCreateDto": { "ActivityCreateDto": {

View file

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

View file

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

View file

@ -110,7 +110,13 @@
Permission.PersonReassign, 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', [ permissions.set('sharedLink', [
Permission.SharedLinkCreate, Permission.SharedLinkCreate,