Skip to content

Commit

Permalink
feat: add writable attribute to fs items
Browse files Browse the repository at this point in the history
  • Loading branch information
KernelDeimos committed Aug 18, 2024
1 parent fc26f88 commit 2386d87
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/backend/src/filesystem/FSNodeContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2386d87

Please sign in to comment.