| @@ 274-305 (lines=32) @@ | ||
| 271 | * |
|
| 272 | * @return \eZ\Publish\API\Repository\Values\User\User |
|
| 273 | */ |
|
| 274 | protected function createUserVersion1() |
|
| 275 | { |
|
| 276 | $repository = $this->getRepository(); |
|
| 277 | ||
| 278 | /* BEGIN: Inline */ |
|
| 279 | // ID of the "Editors" user group in an eZ Publish demo installation |
|
| 280 | $editorsGroupId = 13; |
|
| 281 | ||
| 282 | $userService = $repository->getUserService(); |
|
| 283 | ||
| 284 | // Instantiate a create struct with mandatory properties |
|
| 285 | $userCreate = $userService->newUserCreateStruct( |
|
| 286 | 'user', |
|
| 287 | '[email protected]', |
|
| 288 | 'secret', |
|
| 289 | 'eng-US' |
|
| 290 | ); |
|
| 291 | $userCreate->enabled = true; |
|
| 292 | ||
| 293 | // Set some fields required by the user ContentType |
|
| 294 | $userCreate->setField('first_name', 'Example'); |
|
| 295 | $userCreate->setField('last_name', 'User'); |
|
| 296 | ||
| 297 | // Load parent group for the user |
|
| 298 | $group = $userService->loadUserGroup($editorsGroupId); |
|
| 299 | ||
| 300 | // Create a new user instance. |
|
| 301 | $user = $userService->createUser($userCreate, array($group)); |
|
| 302 | /* END: Inline */ |
|
| 303 | ||
| 304 | return $user; |
|
| 305 | } |
|
| 306 | ||
| 307 | /** |
|
| 308 | * Create a user in new user group with editor rights limited to Media Library (/1/48/). |
|
| @@ 67-98 (lines=32) @@ | ||
| 64 | /** |
|
| 65 | * @return \eZ\Publish\Core\Repository\Values\User\User |
|
| 66 | */ |
|
| 67 | protected function createUserVersion1() |
|
| 68 | { |
|
| 69 | $repository = $this->repository; |
|
| 70 | ||
| 71 | /* BEGIN: Inline */ |
|
| 72 | // ID of the "Editors" user group in an eZ Publish demo installation |
|
| 73 | $editorsGroupId = 13; |
|
| 74 | ||
| 75 | $userService = $repository->getUserService(); |
|
| 76 | ||
| 77 | // Instantiate a create struct with mandatory properties |
|
| 78 | $userCreate = $userService->newUserCreateStruct( |
|
| 79 | 'user', |
|
| 80 | '[email protected]', |
|
| 81 | 'secret', |
|
| 82 | 'eng-US' |
|
| 83 | ); |
|
| 84 | $userCreate->enabled = true; |
|
| 85 | ||
| 86 | // Set some fields required by the user ContentType |
|
| 87 | $userCreate->setField('first_name', 'Example'); |
|
| 88 | $userCreate->setField('last_name', 'User'); |
|
| 89 | ||
| 90 | // Load parent group for the user |
|
| 91 | $group = $userService->loadUserGroup($editorsGroupId); |
|
| 92 | ||
| 93 | // Create a new user instance. |
|
| 94 | $user = $userService->createUser($userCreate, array($group)); |
|
| 95 | /* END: Inline */ |
|
| 96 | ||
| 97 | return $user; |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| 101 | * Tear down test (properties). |
|