-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add readdir delegate for sharing user homedirs
- Loading branch information
1 parent
8424d44
commit 19a5eb0
Showing
3 changed files
with
63 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
packages/backend/src/filesystem/ll_operations/ll_listusers.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const { RootNodeSelector, NodeChildSelector } = require("../node/selectors"); | ||
const { LLFilesystemOperation } = require("./definitions"); | ||
|
||
class LLListUsers extends LLFilesystemOperation { | ||
static description = ` | ||
List user directories which are relevant to the | ||
current actor. | ||
`; | ||
|
||
async _run () { | ||
const { context } = this; | ||
const svc = context.get('services'); | ||
const svc_permission = svc.get('permission'); | ||
const svc_fs = svc.get('filesystem'); | ||
|
||
const user = this.values.user; | ||
const issuers = await svc_permission.list_user_permission_issuers(user); | ||
|
||
const nodes = []; | ||
|
||
nodes.push(await svc_fs.node(new NodeChildSelector( | ||
new RootNodeSelector(), | ||
user.username, | ||
))); | ||
|
||
for ( const issuer of issuers ) { | ||
const node = await svc_fs.node(new NodeChildSelector( | ||
new RootNodeSelector(), | ||
issuer.username)); | ||
nodes.push(node); | ||
} | ||
|
||
return nodes; | ||
} | ||
} | ||
|
||
module.exports = { | ||
LLListUsers, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters