Exemple #1
0
 /**
  * Processor to activate user
  * @param User $user
  * @return mixed
  */
 public function activateUser(User $user)
 {
     // Preparing variables
     $returnValues['processor'] = 'activate_user';
     $returnValues['username'] = $user->getCommonName() . ' (' . $user->getId() . ')';
     // If user is locked
     if ($user && $user->isLocked()) {
         // LDAP activate
         $returnValues['ldap_unlock'] = $this->ldapDriver->ldapUnlockAccount($user);
         // VCS activate
         $returnValues['vcs_unlock'] = $this->gitlabApi->unlockUser($user);
         // PM activate
         $returnValues['pm_unlock'] = $this->redmineApi->unlockUser($user);
         // CI activate
         $this->addTodo('<b>Jenkins - User managment - Activate: </b>' . $user->getUsername());
         // TODO Search for a jenkins internal API user deactivation
         // QA activate
         $returnValues['qa_unlock'] = $this->sonarApi->activateUser($user);
         // DB activate
         $user->setLocked(false);
         $this->em->flush();
         $returnValues['db_unlock'] = !$user->isLocked();
         // Send mail
         $this->mailer->accountUpdate($user, "activation");
         $returnValues['mailIssue'] = true;
     } else {
         $returnValues['ldap_unlock'] = false;
         $returnValues['vcs_unlock'] = false;
         $returnValues['pm_unlock'] = false;
         $returnValues['db_unlock'] = false;
         $returnValues['mailIssue'] = false;
     }
     // Return values
     return $returnValues;
 }