Completed
Push — 6.7 ( 8d5066...b23530 )
by André
14:06
created

testLoadLocationsNoAccess()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 12
nc 1
nop 0
dl 0
loc 22
rs 9.2
c 0
b 0
f 0
1
<?php
2
3
/**
4
 * File containing the LocationServiceAuthorizationTest class.
5
 *
6
 * @copyright Copyright (C) eZ Systems AS. All rights reserved.
7
 * @license For full copyright and license information view LICENSE file distributed with this source code.
8
 */
9
namespace eZ\Publish\API\Repository\Tests;
10
11
use eZ\Publish\API\Repository\Values\Content\Location;
12
use eZ\Publish\API\Repository\Values\User\Limitation\OwnerLimitation;
13
14
/**
15
 * Test case for operations in the LocationService using in memory storage.
16
 *
17
 * @see eZ\Publish\API\Repository\LocationService
18
 * @depends eZ\Publish\API\Repository\Tests\UserServiceTest::testCreateUser
19
 * @group integration
20
 * @group authorization
21
 */
22
class LocationServiceAuthorizationTest extends BaseTest
23
{
24
    /**
25
     * Test for the createLocation() method.
26
     *
27
     * @see \eZ\Publish\API\Repository\LocationService::createLocation()
28
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
29
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testCreateLocation
30
     */
31
    public function testCreateLocationThrowsUnauthorizedException()
32
    {
33
        $repository = $this->getRepository();
34
35
        $editorsGroupId = $this->generateId('group', 13);
36
37
        /* BEGIN: Use Case */
38
        $contentService = $repository->getContentService();
39
        $locationService = $repository->getLocationService();
40
41
        $user = $this->createUserVersion1();
42
43
        // ContentInfo for "Editors" user group
44
        $contentInfo = $contentService->loadContentInfo($editorsGroupId);
45
46
        // Set current user to newly created user
47
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
48
49
        $locationCreate = $locationService->newLocationCreateStruct(1);
50
        $locationCreate->priority = 23;
51
        $locationCreate->hidden = true;
52
        $locationCreate->remoteId = 'sindelfingen';
53
        $locationCreate->sortField = Location::SORT_FIELD_NODE_ID;
54
        $locationCreate->sortOrder = Location::SORT_ORDER_DESC;
55
56
        // This call will fail with an "UnauthorizedException"
57
        $locationService->createLocation(
58
            $contentInfo,
59
            $locationCreate
60
        );
61
        /* END: Use Case */
62
    }
63
64
    /**
65
     * Test for the loadLocation() method.
66
     *
67
     * @see \eZ\Publish\API\Repository\LocationService::loadLocation()
68
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
69
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
70
     */
71
    public function testLoadLocationThrowsUnauthorizedException()
72
    {
73
        $repository = $this->getRepository();
74
75
        $editorsGroupId = $this->generateId('group', 13);
76
77
        /* BEGIN: Use Case */
78
        $locationService = $repository->getLocationService();
79
80
        $user = $this->createUserVersion1();
81
82
        // Set current user to newly created user
83
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
84
85
        // This call will fail with an "UnauthorizedException"
86
        $locationService->loadLocation($editorsGroupId);
87
        /* END: Use Case */
88
    }
89
90
    /**
91
     * Test for the loadLocationByRemoteId() method.
92
     *
93
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
94
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
95
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationByRemoteId
96
     */
97
    public function testLoadLocationByRemoteIdThrowsUnauthorizedException()
98
    {
99
        $repository = $this->getRepository();
100
101
        /* BEGIN: Use Case */
102
        // remoteId of the "Editors" location in an eZ Publish demo installation
103
        $editorsRemoteId = 'f7dda2854fc68f7c8455d9cb14bd04a9';
104
105
        $locationService = $repository->getLocationService();
106
107
        $user = $this->createUserVersion1();
108
109
        // Set current user to newly created user
110
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
111
112
        // This call will fail with an "UnauthorizedException"
113
        $locationService->loadLocationByRemoteId($editorsRemoteId);
114
        /* END: Use Case */
115
    }
116
117
    /**
118
     * Test for the loadLocations() method.
119
     *
120
     * @see \eZ\Publish\API\Repository\LocationService::loadLocations()
121
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocations
122
     */
123
    public function testLoadLocationsNoAccess()
124
    {
125
        $repository = $this->getRepository();
126
        $locationService = $repository->getLocationService();
127
128
        $editorsGroupId = $this->generateId('group', 13);
129
        $editorGroupContentInfo = $repository->getContentService()->loadContentInfo($editorsGroupId);
130
131
        // this should return one location for admin
132
        $locations = $locationService->loadLocations($editorGroupContentInfo);
133
        $this->assertCount(1, $locations);
134
        $this->assertInstanceOf(Location::class, $locations[0]);
135
136
        $user = $this->createUserVersion1();
137
138
        // Set current user to newly created user
139
        $repository->getPermissionResolver()->setCurrentUserReference($user);
140
141
        // This should return empty array given current user does not have read access
142
        $locations = $locationService->loadLocations($editorGroupContentInfo);
143
        $this->assertEmpty($locations);
144
    }
145
146
    /**
147
     * Test for the updateLocation() method.
148
     *
149
     * @see \eZ\Publish\API\Repository\LocationService::updateLocation()
150
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
151
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testUpdateLocation
152
     */
153
    public function testUpdateLocationThrowsUnauthorizedException()
154
    {
155
        $repository = $this->getRepository();
156
157
        $editorsGroupId = $this->generateId('group', 13);
158
159
        /* BEGIN: Use Case */
160
        $user = $this->createUserVersion1();
161
162
        $locationService = $repository->getLocationService();
163
164
        $originalLocation = $locationService->loadLocation($editorsGroupId);
165
166
        $locationUpdateStruct = $locationService->newLocationUpdateStruct();
167
        $locationUpdateStruct->priority = 3;
168
        $locationUpdateStruct->remoteId = 'c7adcbf1e96bc29bca28c2d809d0c7ef69272651';
169
        $locationUpdateStruct->sortField = Location::SORT_FIELD_PRIORITY;
170
        $locationUpdateStruct->sortOrder = Location::SORT_ORDER_DESC;
171
172
        // Set current user to newly created user
173
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
174
175
        // This call will fail with an "UnauthorizedException"
176
        $locationService->updateLocation(
177
            $originalLocation,
178
            $locationUpdateStruct
179
        );
180
        /* END: Use Case */
181
    }
182
183
    /**
184
     * Test for the swapLocation() method.
185
     *
186
     * @see \eZ\Publish\API\Repository\LocationService::swapLocation()
187
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
188
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testSwapLocation
189
     */
190
    public function testSwapLocationThrowsUnauthorizedException()
191
    {
192
        $repository = $this->getRepository();
193
194
        $mediaLocationId = $this->generateId('location', 43);
195
        $demoDesignLocationId = $this->generateId('location', 56);
196
        /* BEGIN: Use Case */
197
        // $mediaLocationId is the ID of the "Media" Location in
198
        // an eZ Publish demo installation
199
200
        // $demoDesignLocationId is the ID of the "Demo Design" Location in an eZ
201
        // Publish demo installation
202
203
        // Load the location service
204
        $locationService = $repository->getLocationService();
205
206
        $mediaLocation = $locationService->loadLocation($mediaLocationId);
207
        $demoDesignLocation = $locationService->loadLocation($demoDesignLocationId);
208
209
        // Swaps the content referred to by the locations
210
        $locationService->swapLocation($mediaLocation, $demoDesignLocation);
211
212
        $user = $this->createMediaUserVersion1();
213
214
        // Set media editor as current user
215
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
216
217
        // This call will fail with an "UnauthorizedException"
218
        $locationService->swapLocation($mediaLocation, $demoDesignLocation);
219
        /* END: Use Case */
220
    }
221
222
    /**
223
     * Test for the hideLocation() method.
224
     *
225
     * @see \eZ\Publish\API\Repository\LocationService::hideLocation()
226
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
227
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testHideLocation
228
     */
229 View Code Duplication
    public function testHideLocationThrowsUnauthorizedException()
230
    {
231
        $repository = $this->getRepository();
232
233
        $editorsGroupId = $this->generateId('group', 13);
234
235
        /* BEGIN: Use Case */
236
        $user = $this->createUserVersion1();
237
238
        $locationService = $repository->getLocationService();
239
240
        $visibleLocation = $locationService->loadLocation($editorsGroupId);
241
242
        // Set current user to newly created user
243
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
244
245
        // This call will fail with an "UnauthorizedException"
246
        $locationService->hideLocation($visibleLocation);
247
        /* END: Use Case */
248
    }
249
250
    /**
251
     * Test for the unhideLocation() method.
252
     *
253
     * @see \eZ\Publish\API\Repository\LocationService::unhideLocation()
254
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
255
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testUnhideLocation
256
     */
257
    public function testUnhideLocationThrowsUnauthorizedException()
258
    {
259
        $repository = $this->getRepository();
260
261
        $editorsGroupId = $this->generateId('group', 13);
262
263
        /* BEGIN: Use Case */
264
        $user = $this->createUserVersion1();
265
266
        $locationService = $repository->getLocationService();
267
268
        $visibleLocation = $locationService->loadLocation($editorsGroupId);
269
270
        // Hide location
271
        $hiddenLocation = $locationService->hideLocation($visibleLocation);
272
273
        // Set current user to newly created user
274
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
275
276
        // This call will fail with an "UnauthorizedException"
277
        $locationService->unhideLocation($hiddenLocation);
278
        /* END: Use Case */
279
    }
280
281
    /**
282
     * Test for the deleteLocation() method.
283
     *
284
     * @see \eZ\Publish\API\Repository\LocationService::deleteLocation()
285
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
286
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testDeleteLocation
287
     */
288 View Code Duplication
    public function testDeleteLocationThrowsUnauthorizedException()
289
    {
290
        $repository = $this->getRepository();
291
292
        $editorsGroupId = $this->generateId('group', 13);
293
294
        /* BEGIN: Use Case */
295
        $user = $this->createUserVersion1();
296
297
        $locationService = $repository->getLocationService();
298
299
        $location = $locationService->loadLocation($editorsGroupId);
300
301
        // Set current user to newly created user
302
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
303
304
        // This call will fail with an "UnauthorizedException"
305
        $locationService->deleteLocation($location);
306
        /* END: Use Case */
307
    }
308
309
    /**
310
     * Test for the deleteLocation() method.
311
     *
312
     * @see \eZ\Publish\API\Repository\LocationService::deleteLocation()
313
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
314
     * @expectedExceptionMessage User does not have access to 'remove' 'content'
315
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testDeleteLocation
316
     */
317
    public function testDeleteLocationWithSubtreeThrowsUnauthorizedException()
318
    {
319
        $repository = $this->getRepository();
320
321
        $parentLocationId = $this->generateId('location', 43);
322
        $administratorUserId = $this->generateId('user', 14);
323
324
        /* BEGIN: Use Case */
325
        $user = $this->createUserVersion1();
326
327
        $roleService = $repository->getRoleService();
328
329
        $role = $roleService->loadRoleByIdentifier('Editor');
330
331
        $removePolicy = null;
332
        foreach ($role->getPolicies() as $policy) {
333
            if ('content' != $policy->module || 'remove' != $policy->function) {
334
                continue;
335
            }
336
            $removePolicy = $policy;
337
            break;
338
        }
339
340
        if (null === $removePolicy) {
341
            throw new \ErrorException('No content:remove policy found.');
342
        }
343
344
        // Update content/remove policy to only allow removal of the user's own content
345
        $policyUpdate = $roleService->newPolicyUpdateStruct();
346
        $policyUpdate->addLimitation(
347
            new OwnerLimitation(
348
                array('limitationValues' => array(1))
349
            )
350
        );
351
        $roleService->updatePolicy($removePolicy, $policyUpdate);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...Service::updatePolicy() has been deprecated with message: since 6.0, use {@link updatePolicyByRoleDraft()} instead.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
352
353
        // Set current user to newly created user
354
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
355
356
        $locationService = $repository->getLocationService();
357
        $contentService = $repository->getContentService();
358
        $contentTypeService = $repository->getContentTypeService();
359
        $userService = $repository->getUserService();
360
361
        // Create and publish Content with Location under $parentLocationId
362
        $contentType = $contentTypeService->loadContentTypeByIdentifier('folder');
363
364
        $contentCreateStruct = $contentService->newContentCreateStruct($contentType, 'eng-US');
365
        $contentCreateStruct->setField('name', 'My awesome possibly deletable folder');
366
        $contentCreateStruct->alwaysAvailable = true;
367
368
        $locationCreateStruct = $locationService->newLocationCreateStruct($parentLocationId);
369
370
        $contentDraft = $contentService->createContent($contentCreateStruct, array($locationCreateStruct));
371
        $content = $contentService->publishVersion($contentDraft->versionInfo);
372
373
        // New user will be able to delete this Location at this point
374
        $firstLocation = $locationService->loadLocation($content->contentInfo->mainLocationId);
375
376
        // Set current user to administrator user
377
        $administratorUser = $userService->loadUser($administratorUserId);
378
        $repository->setCurrentUser($administratorUser);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
379
380
        // Under newly created Location create Content with administrator user
381
        // After this created user will not be able to delete $firstLocation
382
        $locationCreateStruct = $locationService->newLocationCreateStruct($firstLocation->id);
383
        $contentDraft = $contentService->createContent($contentCreateStruct, array($locationCreateStruct));
384
        $content = $contentService->publishVersion($contentDraft->versionInfo);
385
        $secondLocation = $locationService->loadLocation($content->contentInfo->mainLocationId);
0 ignored issues
show
Unused Code introduced by
$secondLocation is not used, you could remove the assignment.

This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.

$myVar = 'Value';
$higher = false;

if (rand(1, 6) > 3) {
    $higher = true;
} else {
    $higher = false;
}

Both the $myVar assignment in line 1 and the $higher assignment in line 2 are dead. The first because $myVar is never used and the second because $higher is always overwritten for every possible time line.

Loading history...
386
387
        // Set current user to newly created user again, and try to delete $firstLocation
388
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
389
390
        $this->refreshSearch($repository);
391
392
        // This call will fail with an "UnauthorizedException" because user does not have
393
        // permission to delete $secondLocation which is in the subtree of the $firstLocation
394
        $locationService->deleteLocation($firstLocation);
395
        /* END: Use Case */
396
    }
397
398
    /**
399
     * Test for the copySubtree() method.
400
     *
401
     * @see \eZ\Publish\API\Repository\LocationService::copySubtree()
402
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
403
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testCopySubtree
404
     */
405
    public function testCopySubtreeThrowsUnauthorizedException()
406
    {
407
        $repository = $this->getRepository();
408
409
        $mediaLocationId = $this->generateId('location', 43);
410
        $demoDesignLocationId = $this->generateId('location', 56);
411
        /* BEGIN: Use Case */
412
        $user = $this->createMediaUserVersion1();
413
414
        // $mediaLocationId is the ID of the "Media" Location in
415
        // an eZ Publish demo installation
416
417
        // $demoDesignLocationId is the ID of the "Demo Design" Location in an eZ
418
        // Publish demo installation
419
420
        // Load the location service
421
        $locationService = $repository->getLocationService();
422
423
        // Load location to copy
424
        $locationToCopy = $locationService->loadLocation($mediaLocationId);
425
426
        // Load new parent location
427
        $newParentLocation = $locationService->loadLocation($demoDesignLocationId);
428
429
        // Set media editor as current user
430
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
431
432
        // This call will fail with an "UnauthorizedException"
433
        $locationService->copySubtree(
434
            $locationToCopy,
435
            $newParentLocation
436
        );
437
        /* END: Use Case */
438
    }
439
440
    /**
441
     * Test for the moveSubtree() method.
442
     *
443
     * @see \eZ\Publish\API\Repository\LocationService::moveSubtree()
444
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
445
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testMoveSubtree
446
     */
447
    public function testMoveSubtreeThrowsUnauthorizedException()
448
    {
449
        $repository = $this->getRepository();
450
451
        $mediaLocationId = $this->generateId('location', 43);
452
        $demoDesignLocationId = $this->generateId('location', 56);
453
        /* BEGIN: Use Case */
454
        $user = $this->createMediaUserVersion1();
455
456
        // $mediaLocationId is the ID of the "Media" page location in
457
        // an eZ Publish demo installation
458
459
        // $demoDesignLocationId is the ID of the "Demo Design" page location in an eZ
460
        // Publish demo installation
461
462
        // Load the location service
463
        $locationService = $repository->getLocationService();
464
465
        // Load location to move
466
        $locationToMove = $locationService->loadLocation($mediaLocationId);
467
468
        // Load new parent location
469
        $newParentLocation = $locationService->loadLocation($demoDesignLocationId);
470
471
        // Set media editor as current user
472
        $repository->setCurrentUser($user);
0 ignored issues
show
Deprecated Code introduced by
The method eZ\Publish\API\Repositor...itory::setCurrentUser() has been deprecated with message: since 6.6, to be removed. Use PermissionResolver::setCurrentUserReference() instead. Sets the current user to the given $user.

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
473
474
        // This call will fail with an "UnauthorizedException"
475
        $locationService->moveSubtree(
476
            $locationToMove,
477
            $newParentLocation
478
        );
479
        /* END: Use Case */
480
    }
481
}
482