|
18 | 18 | */
|
19 | 19 | const APIError = require("../../api/APIError");
|
20 | 20 | const { chkperm } = require("../../helpers");
|
21 |
| -const { TYPE_DIRECTORY } = require("../FSNodeContext"); |
| 21 | +const { TYPE_DIRECTORY, TYPE_SYMLINK } = require("../FSNodeContext"); |
22 | 22 | const { LLListUsers } = require("../ll_operations/ll_listusers");
|
23 | 23 | const { LLReadDir } = require("../ll_operations/ll_readdir");
|
24 | 24 | const { LLReadShares } = require("../ll_operations/ll_readshares");
|
25 | 25 | const { HLFilesystemOperation } = require("./definitions");
|
26 | 26 |
|
27 | 27 | class HLReadDir extends HLFilesystemOperation {
|
28 | 28 | async _run () {
|
29 |
| - const { subject, user, no_thumbs, no_assocs, actor } = this.values; |
| 29 | + const { subject: subject_let, user, no_thumbs, no_assocs, actor } = this.values; |
| 30 | + let subject = subject_let; |
30 | 31 |
|
31 | 32 | if ( ! await subject.exists() ) {
|
32 | 33 | throw APIError.create('subject_does_not_exist');
|
33 | 34 | }
|
34 | 35 |
|
| 36 | + if ( await subject.get('type') === TYPE_SYMLINK ) { |
| 37 | + const { context } = this; |
| 38 | + const svc_acl = context.get('services').get('acl'); |
| 39 | + if ( ! await svc_acl.check(actor, subject, 'read') ) { |
| 40 | + throw await svc_acl.get_safe_acl_error(actor, subject, 'read'); |
| 41 | + } |
| 42 | + const target = await subject.getTarget(); |
| 43 | + subject = target; |
| 44 | + } |
| 45 | + |
35 | 46 | if ( await subject.get('type') !== TYPE_DIRECTORY ) {
|
36 | 47 | const { context } = this;
|
37 | 48 | const svc_acl = context.get('services').get('acl');
|
|
0 commit comments