From 2386d87229aa6205ef8ced6563371ab40a0def62 Mon Sep 17 00:00:00 2001 From: KernelDeimos Date: Sun, 18 Aug 2024 15:22:10 -0400 Subject: [PATCH] feat: add writable attribute to fs items --- src/backend/src/filesystem/FSNodeContext.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/backend/src/filesystem/FSNodeContext.js b/src/backend/src/filesystem/FSNodeContext.js index fe421be63..219a19343 100644 --- a/src/backend/src/filesystem/FSNodeContext.js +++ b/src/backend/src/filesystem/FSNodeContext.js @@ -659,6 +659,13 @@ module.exports = class FSNodeContext { await this.fetchEntry(); return this.isRoot; } + + if ( key === 'writable' ) { + const actor = Context.get('actor'); + if ( !actor || !actor.type.user ) return undefined; + const svc_acl = this.services.get('acl'); + return await svc_acl.check(actor, this, 'write'); + } throw new Error(`unrecognize key for FSNodeContext.get: ${key}`); } @@ -789,6 +796,7 @@ module.exports = class FSNodeContext { fsentry.dirname = _path.dirname(fsentry.path); fsentry.dirpath = fsentry.dirname; + fsentry.writable = await this.get('writable'); // Do not send internal IDs to clients fsentry.id = res.uuid;