@@ -76,7 +76,7 @@ class MkTree extends HLFilesystemOperation {
76
76
const { context, values } = this ;
77
77
const { _path } = this . modules ;
78
78
const fs = context . get ( 'services' ) . get ( 'filesystem' ) ;
79
- const user = context . get ( 'user ' ) ;
79
+ const actor = context . get ( 'actor ' ) ;
80
80
81
81
const trunk = tree [ 0 ] ;
82
82
const branches = tree . slice ( 1 ) ;
@@ -124,7 +124,7 @@ class MkTree extends HLFilesystemOperation {
124
124
125
125
if ( parent_did_exist && ! parent_exists ) {
126
126
const node = await fs . node ( current ) ;
127
- const has_perm = await chkperm ( await node . get ( 'entry' ) , user . id , 'write' ) ;
127
+ const has_perm = await chkperm ( await node . get ( 'entry' ) , actor . type . user . id , 'write' ) ;
128
128
if ( ! has_perm ) throw APIError . create ( 'permission_denied' ) ;
129
129
}
130
130
@@ -147,7 +147,7 @@ class MkTree extends HLFilesystemOperation {
147
147
const node = await fs . mkdir_2 ( {
148
148
parent : await fs . node ( currentParent ) ,
149
149
name : current . name ,
150
- user ,
150
+ actor ,
151
151
} )
152
152
153
153
current = node . selector ;
@@ -179,7 +179,7 @@ class QuickMkdir extends HLFilesystemOperation {
179
179
let { parent, path } = values ;
180
180
const { _path } = this . modules ;
181
181
const fs = context . get ( 'services' ) . get ( 'filesystem' ) ;
182
- const user = context . get ( 'user ' ) ;
182
+ const actor = context . get ( 'actor ' ) ;
183
183
184
184
parent = parent || await fs . node ( new RootNodeSelector ( ) ) ;
185
185
@@ -206,7 +206,7 @@ class QuickMkdir extends HLFilesystemOperation {
206
206
const node = await fs . mkdir_2 ( {
207
207
parent : await fs . node ( currentParent ) ,
208
208
name : current . name ,
209
- user ,
209
+ actor ,
210
210
} )
211
211
212
212
current = node . selector ;
@@ -285,10 +285,12 @@ class HLMkdir extends HLFilesystemOperation {
285
285
// specified under `path`.
286
286
parent_node = await this . _create_parents ( {
287
287
parent_node : top_parent ,
288
- user : values . user ,
288
+ actor : values . actor ,
289
289
} ) ;
290
290
291
- const has_perm = await chkperm ( await parent_node . get ( 'entry' ) , values . user . id , 'write' ) ;
291
+ const user_id = values . actor . type . user . id ;
292
+
293
+ const has_perm = await chkperm ( await parent_node . get ( 'entry' ) , user_id , 'write' ) ;
292
294
if ( ! has_perm ) throw APIError . create ( 'permission_denied' ) ;
293
295
294
296
const existing = await fs . node (
@@ -301,12 +303,12 @@ class HLMkdir extends HLFilesystemOperation {
301
303
const { overwrite, dedupe_name, create_missing_parents } = values ;
302
304
if ( overwrite ) {
303
305
// TODO: tag rm operation somehow
304
- const has_perm = await chkperm ( await existing . get ( 'entry' ) , values . user . id , 'write' ) ;
306
+ const has_perm = await chkperm ( await existing . get ( 'entry' ) , user_id , 'write' ) ;
305
307
if ( ! has_perm ) throw APIError . create ( 'permission_denied' ) ;
306
308
const hl_remove = new HLRemove ( ) ;
307
309
await hl_remove . run ( {
308
310
target : existing ,
309
- user : values . user ,
311
+ actor : values . actor ,
310
312
recursive : true ,
311
313
} ) ;
312
314
}
@@ -345,13 +347,13 @@ class HLMkdir extends HLFilesystemOperation {
345
347
if ( ! shortcut_to . entry . is_dir ) {
346
348
throw APIError . create ( 'shortcut_target_is_a_directory' ) ;
347
349
}
348
- const has_perm = await chkperm ( shortcut_to . entry , values . user . id , 'read' ) ;
350
+ const has_perm = await chkperm ( shortcut_to . entry , user_id , 'read' ) ;
349
351
if ( ! has_perm ) throw APIError . create ( 'forbidden' ) ;
350
352
351
353
this . created = await fs . mkshortcut ( {
352
354
parent : parent_node ,
353
355
name : target_basename ,
354
- user : values . user ,
356
+ actor : values . actor ,
355
357
target : shortcut_to ,
356
358
} ) ;
357
359
@@ -362,7 +364,7 @@ class HLMkdir extends HLFilesystemOperation {
362
364
this . created = await fs . mkdir_2 ( {
363
365
parent : parent_node ,
364
366
name : target_basename ,
365
- user : values . user ,
367
+ actor : values . actor ,
366
368
} ) ;
367
369
368
370
const all_nodes = [
@@ -382,7 +384,7 @@ class HLMkdir extends HLFilesystemOperation {
382
384
return response ;
383
385
}
384
386
385
- async _create_parents ( { parent_node, user } ) {
387
+ async _create_parents ( { parent_node } ) {
386
388
const { context, values } = this ;
387
389
const { _path } = this . modules ;
388
390
const fs = context . get ( 'services' ) . get ( 'filesystem' ) ;
0 commit comments