assign section to new user group

possibility to assign section to new user group
This commit is contained in:
Anis Jrad
2017-02-07 18:16:06 +01:00
committed by GitHub
parent a19944f4e8
commit 11400a1ffc
+13
View File
@@ -28,6 +28,7 @@ class UserGroupManager extends RepositoryExecutor
protected function create()
{
$userService = $this->repository->getUserService();
$sectionService = $this->repository->getSectionService();
$parentGroupId = $this->dsl['parent_group_id'];
$parentGroupId = $this->referenceResolver->resolveReference($parentGroupId);
@@ -46,6 +47,18 @@ class UserGroupManager extends RepositoryExecutor
$userGroupCreateStruct->setField('description', $this->dsl['description']);
}
if (isset($this->dsl['section'])) {
$sectionId = $this->dsl['section'];
try {
$section = $sectionService->loadSectionByIdentifier($sectionId);
$sectionId = $section->id;
}
catch (\eZ\Publish\API\Repository\Exceptions\NotFoundException $notFoundException) {
$sectionId = $this->referenceResolver->resolveReference($sectionId);
}
$userGroupCreateStruct->sectionId = $sectionId;
}
$userGroup = $userService->createUserGroup($userGroupCreateStruct, $parentGroup);
if (isset($this->dsl['roles'])) {