feat: アップロード可能な最大ファイルサイズをロールごとに設定可能に

This commit is contained in:
syuilo 2025-04-27 09:35:44 +09:00
parent effc84b9cc
commit 9481b5a6e8
12 changed files with 59 additions and 2 deletions

View file

@ -522,9 +522,16 @@ export class DriveService {
const policies = await this.roleService.getUserPolicies(user.id);
const driveCapacity = 1024 * 1024 * policies.driveCapacityMb;
const maxFileSize = 1024 * 1024 * policies.maxFileSizeMb;
this.registerLogger.debug('drive capacity override applied');
this.registerLogger.debug(`overrideCap: ${driveCapacity}bytes, usage: ${usage}bytes, u+s: ${usage + info.size}bytes`);
if (maxFileSize < info.size) {
if (isLocalUser) {
throw new IdentifiableError('f9e4e5f3-4df4-40b5-b400-f236945f7073', 'Max file size exceeded.');
}
}
// If usage limit exceeded
if (driveCapacity < usage + info.size) {
if (isLocalUser) {