Skip to content

Commit

Permalink
minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
reithor committed Jun 30, 2024
1 parent 840300a commit d8fdddb
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,16 @@ public function testUpdateContentHavingPrivateRelation(): void
$sectionService = $repository->getSectionService();
$contentService = $repository->getContentService();
$userService = $repository->getUserService();
$roleService = $repository->getRoleService();
$permissionResolver = $repository->getPermissionResolver();

/* BEGIN: Use Case */
// 1. Add relation field to 'folder' ContentType
$folderType = $contentTypeService->loadContentTypeByIdentifier('folder');
$folderTypeDraft = $contentTypeService->createContentTypeDraft($folderType);

$titleFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('relations', 'ezobjectrelationlist');
$titleFieldCreateStruct->names = ['eng-GB' => 'Relations'];
$titleFieldCreateStruct->descriptions = ['eng-GB' => 'Relations'];
$titleFieldCreateStruct->fieldGroup = 'content';
$titleFieldCreateStruct->position = 10;
$titleFieldCreateStruct->isTranslatable = false;
$titleFieldCreateStruct->isRequired = false;
$titleFieldCreateStruct->isSearchable = false;
$contentTypeService->addFieldDefinition($folderTypeDraft, $titleFieldCreateStruct);
$relationsFieldCreateStruct = $contentTypeService->newFieldDefinitionCreateStruct('relations', 'ezobjectrelationlist');
$relationsFieldCreateStruct->names = ['eng-GB' => 'Relations'];
$contentTypeService->addFieldDefinition($folderTypeDraft, $relationsFieldCreateStruct);
$contentTypeService->publishContentTypeDraft($folderTypeDraft);

// 2. Add Section 'private'
Expand All @@ -69,15 +63,15 @@ public function testUpdateContentHavingPrivateRelation(): void
$contentService->publishVersion($folder->getVersionInfo());

// 5. Create User that has no access to content in $privateSection
$editorRole = $repository->getRoleService()->loadRole(3);
$editorRole = $roleService->loadRole(3);
// remove existing role assignments
foreach ($repository->getRoleService()->getRoleAssignments($editorRole) as $role) {
$repository->getRoleService()->removeRoleAssignment($role);
foreach ($roleService->getRoleAssignments($editorRole) as $role) {
$roleService->removeRoleAssignment($role);
}

$editorUserGroup = $userService->loadUserGroup(13);
// grant access to standard section
$repository->getRoleService()->assignRoleToUserGroup(
$roleService->assignRoleToUserGroup(
$editorRole,
$editorUserGroup,
new SectionLimitation(['limitationValues' => [1]])
Expand Down

0 comments on commit d8fdddb

Please sign in to comment.