eZ\Bundle\EzPublishRestBundle\Features\Context\SubContext\Authentication::usePermissionsOfRole PHP Method

usePermissionsOfRole() public method

public usePermissionsOfRole ( $role )
    public function usePermissionsOfRole($role)
    {
        $credentials = $this->getCredentialsFor($role);
        switch ($this->authType) {
            case self::AUTHTYPE_BASICHTTP:
                $this->restDriver->setAuthentication($credentials['login'], $credentials['password']);
                break;
            case self::AUTHTYPE_SESSION:
                $this->createSession($credentials['login'], $credentials['password']);
                break;
            default:
                throw new \Exception("Unknown auth type: '{$this->authType}'.");
        }
        // also authenticate the user on the local repository instance
        $this->getRepository()->setCurrentUser($this->getRepository()->getUserService()->loadUserByLogin($credentials['login']));
    }