getCategorizedPermissions example

$permissions = $this->makePermissions($privilegesDelta);

        $permissionCollection = new PermissionCollection();

        foreach ($permissions as $permission) {
            $permissionCollection->add(PermissionStruct::fromArray([
                'entity' => $permission['entity'],
                'operation' => $permission['operation'],
            ]));
        }

        return $permissionCollection->getCategorizedPermissions();
    }
}
'operation' => AclRoleDefinition::PRIVILEGE_DELETE,
        ],
        [
            'entity' => 'plugin',
            'operation' => AclRoleDefinition::PRIVILEGE_READ,
        ],
    ];

    public function testItCategorizesAPermissionCollection(): void
    {
        $permissionCollection = new PermissionCollection(self::PERMISSIONS);
        $categorizedCollection = $permissionCollection->getCategorizedPermissions();

        static::assertCount(3, $categorizedCollection);
        static::assertEquals([
            'product',
            'promotion',
            'other',
        ]array_keys($categorizedCollection));
    }

    public function testItAddsMissingReadPermissionDependencies(): void
    {
        


    /** * @return array<string, PermissionCollection> */
    public function getCategorizedPermissions(): array
    {
        if ($this->permissions === null) {
            return [];
        }

        return $this->permissions->getCategorizedPermissions();
    }

    public function jsonSerialize(): array
    {
        $vars = get_object_vars($this);
        $vars['permissions'] = $this->getCategorizedPermissions();

        return $vars;
    }

    public function getActive(): bool
    {
Home | Imprint | This part of the site doesn't use cookies.