-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/4.6'
- Loading branch information
Showing
15 changed files
with
601 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,4 +46,8 @@ | |
} | ||
} | ||
} | ||
|
||
.ibexa-label--checkbox-radio { | ||
padding-left: calculateRem(4px); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
src/lib/REST/Output/ValueObjectVisitor/ContentTree/NodeExtendedInfoVisitor.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\AdminUi\REST\Output\ValueObjectVisitor\ContentTree; | ||
|
||
use Ibexa\Contracts\Rest\Output\Generator; | ||
use Ibexa\Contracts\Rest\Output\ValueObjectVisitor; | ||
use Ibexa\Contracts\Rest\Output\Visitor; | ||
use Symfony\Component\HttpFoundation\Response; | ||
|
||
/** | ||
* @phpstan-import-type TPermissionRestrictions from \Ibexa\AdminUi\REST\Value\ContentTree\NodeExtendedInfo | ||
*/ | ||
final class NodeExtendedInfoVisitor extends ValueObjectVisitor | ||
{ | ||
public const MAIN_ELEMENT = 'ContentTreeNodeExtendedInfo'; | ||
|
||
/** | ||
* @param \Ibexa\AdminUi\REST\Value\ContentTree\NodeExtendedInfo $data | ||
*/ | ||
public function visit(Visitor $visitor, Generator $generator, $data): void | ||
{ | ||
$generator->startObjectElement(self::MAIN_ELEMENT); | ||
$visitor->setHeader('Content-Type', $generator->getMediaType(self::MAIN_ELEMENT)); | ||
$visitor->setStatus(Response::HTTP_OK); | ||
|
||
$this->buildPermissionNode($data->getPermissionRestrictions(), $generator); | ||
|
||
$generator->endObjectElement(self::MAIN_ELEMENT); | ||
} | ||
|
||
/** | ||
* @phpstan-param TPermissionRestrictions $permissionRestrictions | ||
*/ | ||
protected function buildPermissionNode( | ||
?array $permissionRestrictions, | ||
Generator $generator | ||
): void { | ||
if (null === $permissionRestrictions) { | ||
return; | ||
} | ||
|
||
$generator->startList('permissions'); | ||
|
||
foreach ($permissionRestrictions as $function => $restrictions) { | ||
$generator->startHashElement('function'); | ||
$generator->attribute('name', $function); | ||
foreach ($restrictions as $restrictionKey => $restrictionValue) { | ||
if (is_array($restrictionValue)) { | ||
$generator->startHashElement($restrictionKey . 'List'); | ||
$generator->startList($restrictionKey); | ||
foreach ($restrictionValue as $value) { | ||
$generator->valueElement('value', $value); | ||
} | ||
$generator->endList($restrictionKey); | ||
$generator->endHashElement($restrictionKey . 'List'); | ||
} elseif (is_bool($restrictionValue)) { | ||
$generator->valueElement($restrictionKey, $generator->serializeBool($restrictionValue)); | ||
} | ||
} | ||
$generator->endHashElement('function'); | ||
} | ||
|
||
$generator->endList('permissions'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
/** | ||
* @copyright Copyright (C) Ibexa AS. All rights reserved. | ||
* @license For full copyright and license information view LICENSE file distributed with this source code. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Ibexa\AdminUi\REST\Value\ContentTree; | ||
|
||
use Ibexa\Rest\Value as RestValue; | ||
|
||
/** | ||
* @phpstan-type TRestrictions array{ | ||
* hasAccess: bool, | ||
* restrictedContentTypeIds?: array<int>, | ||
* restrictedLanguageCodes?: array<string>, | ||
* } | ||
* | ||
* @phpstan-type TPermissionRestrictions array{ | ||
* create: TRestrictions, | ||
* edit: TRestrictions, | ||
* delete: TRestrictions, | ||
* hide: TRestrictions, | ||
* } | ||
*/ | ||
final class NodeExtendedInfo extends RestValue | ||
{ | ||
/** @phpstan-var TPermissionRestrictions|null */ | ||
private ?array $permissions; | ||
|
||
/** | ||
* @phpstan-param TPermissionRestrictions|null $permissions | ||
*/ | ||
public function __construct( | ||
?array $permissions = null | ||
) { | ||
$this->permissions = $permissions; | ||
} | ||
|
||
/** | ||
* @return TPermissionRestrictions|null | ||
*/ | ||
public function getPermissionRestrictions(): ?array | ||
{ | ||
return $this->permissions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.