public function getAllPresenceRights()
 {
     $toflush = false;
     $allRights = $this->rightsRepo->findAll();
     $rolesPlateforme = $this->roleManager->getAllPlatformRoles();
     $existentRights = array();
     foreach ($allRights as $oneRight) {
         $role = $oneRight->getRole();
         $existentRights[$role->getId()] = $oneRight;
     }
     foreach ($rolesPlateforme as $oneRolePlateforme) {
         if (!isset($existentRights[$oneRolePlateforme->getId()])) {
             $toflush = true;
             $newRight = new PresenceRights();
             $newRight->setRole($oneRolePlateforme);
             $newRight->setMask(PresenceRights::PERSONAL_ARCHIVES);
             $this->om->persist($newRight);
             $existentRights[$oneRolePlateforme->getId()] = $newRight;
         }
     }
     if ($toflush) {
         $this->om->flush();
     }
     return $existentRights;
 }
 /**
  * @EXT\Route(
  *     "/admin/presence/right/right/{right}/rightValue/{rightValue}",
  *     name="formalibre_presence_admin_right",
  *     options={"expose"=true}
  * )
  *
  * @EXT\ParamConverter("user", options={"authenticatedUser" = true})
  */
 public function adminRightAction(PresenceRights $right, $rightValue)
 {
     $mask = $right->getMask();
     $newmask = $mask ^ $rightValue;
     $right->setMask($newmask);
     $this->om->persist($right);
     $this->om->flush();
     return new Response('success', 200);
 }