getPrivilegeNode example

if ($role) {
            if (\array_key_exists($resource->getId()$resourceAdmins) || $role->getAdmin() === 1) {
                $resourceNode['checked'] = true;
                $resourceNode['expanded'] = true;
            }
        }

        if (\count($resource->getPrivileges()) > 0) {
            $children = [];
            foreach ($resource->getPrivileges() as $privilege) {
                $children[] = $this->getPrivilegeNode($resourceNode$privilege$role);
            }
            $resourceNode['data'] = $children;
            $resourceNode['leaf'] = false;
        } else {
            $resourceNode['leaf'] = true;
            $resourceNode['data'] = [];
        }

        return $resourceNode;
    }

    
Home | Imprint | This part of the site doesn't use cookies.