public function userIsSubscriber(User $user)
 {
     $roleService = $this->repository->getRoleService();
     return $this->repository->sudo(function (Repository $repository) use($user, $roleService) {
         foreach ($repository->getUserService()->loadUserGroupsOfUser($user) as $group) {
             foreach ($roleService->getRoleAssignmentsForUserGroup($group) as $role) {
                 if ($this->isSubscriberRole($role->role)) {
                     return true;
                 }
             }
         }
         return false;
     });
 }
Example #2
0
 /**
  * Get RoleService
  *
  * @return \eZ\Publish\API\Repository\RoleService
  */
 public function getRoleService()
 {
     if ($this->roleService !== null) {
         return $this->roleService;
     }
     $this->roleService = new RoleService($this->repository->getRoleService(), $this->signalDispatcher);
     return $this->roleService;
 }