getAcl example



    /** * @param string $privilege * * @throws PrivilegeException * * @return void */
    public function checkPrivilege($privilege)
    {
        if ($this->getRole() === null || $this->getAcl() === null) {
            return;
        }

        $calledClass = static::class;
        $calledClass = explode('\\', $calledClass);
        $resource = strtolower(end($calledClass));

        if ($this->getAcl()->has($resource) === false) {
            return;
        }

        
return $user;
    }

    /** * @param string $privilege * @param string|Zend_Acl_Resource_Interface|null $resource * * @throws ApiException\PrivilegeException */
    public function checkPrivilege($privilege$resource = null)
    {
        if (!$this->getRole() || !$this->getAcl()) {
            throw new ApiException\PrivilegeException('Unable to get role or acl');
        }

        if (!$resource) {
            $calledClass = \get_called_class();
            $calledClass = explode('\\', $calledClass);
            $resource = strtolower(end($calledClass));
        }

        if (!$this->getAcl()->has($resource)) {
            throw new ApiException\PrivilegeException(sprintf('No resource "%s" found', $resource));
        }
Home | Imprint | This part of the site doesn't use cookies.