mirror of
https://github.com/jbcr/ezmigrationbundle.git
synced 2026-04-27 18:43:25 +02:00
assign section to new user group
possibility to assign section to new user group
This commit is contained in:
@@ -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'])) {
|
||||
|
||||
Reference in New Issue
Block a user