Ejemplo n.º 1
0
 /**
  * Loads all policies from roles which are assigned to a user or to user groups to which the user belongs
  *
  * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException if a user with the given id was not found
  *
  * @param mixed $userId
  *
  * @return \eZ\Publish\API\Repository\Values\User\Policy[]
  */
 public function loadPoliciesByUserId($userId)
 {
     $spiPolicies = $this->userHandler->loadPoliciesByUserId($userId);
     $policies = array();
     foreach ($spiPolicies as $spiPolicy) {
         $policies[] = $this->buildDomainPolicyObject($spiPolicy);
     }
     if (empty($policies)) {
         $this->userHandler->load($userId);
     }
     // For NotFoundException in case userId is invalid
     return $policies;
 }