|
@@ 236-251 (lines=16) @@
|
| 233 |
|
* |
| 234 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to create a user group |
| 235 |
|
*/ |
| 236 |
|
public function deleteUserGroup(APIUserGroup $userGroup) |
| 237 |
|
{ |
| 238 |
|
$loadedUserGroup = $this->loadUserGroup($userGroup->id); |
| 239 |
|
|
| 240 |
|
$this->repository->beginTransaction(); |
| 241 |
|
try { |
| 242 |
|
//@todo: what happens to sub user groups and users below sub user groups |
| 243 |
|
$affectedLocationIds = $this->repository->getContentService()->deleteContent($loadedUserGroup->getVersionInfo()->getContentInfo()); |
| 244 |
|
$this->repository->commit(); |
| 245 |
|
} catch (Exception $e) { |
| 246 |
|
$this->repository->rollback(); |
| 247 |
|
throw $e; |
| 248 |
|
} |
| 249 |
|
|
| 250 |
|
return $affectedLocationIds; |
| 251 |
|
} |
| 252 |
|
|
| 253 |
|
/** |
| 254 |
|
* Moves the user group to another parent. |
|
@@ 630-645 (lines=16) @@
|
| 627 |
|
* |
| 628 |
|
* @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException if the authenticated user is not allowed to delete the user |
| 629 |
|
*/ |
| 630 |
|
public function deleteUser(APIUser $user) |
| 631 |
|
{ |
| 632 |
|
$loadedUser = $this->loadUser($user->id); |
| 633 |
|
|
| 634 |
|
$this->repository->beginTransaction(); |
| 635 |
|
try { |
| 636 |
|
$affectedLocationIds = $this->repository->getContentService()->deleteContent($loadedUser->getVersionInfo()->getContentInfo()); |
| 637 |
|
$this->userHandler->delete($loadedUser->id); |
| 638 |
|
$this->repository->commit(); |
| 639 |
|
} catch (Exception $e) { |
| 640 |
|
$this->repository->rollback(); |
| 641 |
|
throw $e; |
| 642 |
|
} |
| 643 |
|
|
| 644 |
|
return $affectedLocationIds; |
| 645 |
|
} |
| 646 |
|
|
| 647 |
|
/** |
| 648 |
|
* Updates a user. |