Beispiel #1
0
 /**
  * New user registration mailling
  *  To User
  *  To Admin
  * @param Demand $demand
  */
 public function newUserSendMail(Demand $demand)
 {
     // Send user mail
     // Define necessary vars
     $template = 'SpiritDevDBoxPortalBundle:Mailer/Registration:userRegistration.html.twig';
     // Template
     $subject = $this->getSubject('User registration');
     // Subject
     $rendered = $this->templating->render($template, array('firstname' => $demand->getContent()['firstname'], 'lastname' => $demand->getContent()['lastname']));
     // Template rendering
     $userMail = $demand->getContent()['user_mail'];
     // Mail to
     // Send Mail
     $this->sendEmailMessage($rendered, $subject, $userMail);
     // Send admin mail
     $this->sendNewDemandAdminMail($demand, 'Admin - User registraiton request');
 }
 /**
  * @param Demand $demandToProcess
  * @return bool|null
  */
 protected function processLdapUserRegister(Demand $demandToProcess)
 {
     $demandToProcessContent = $demandToProcess->getContent();
     // Defining username
     // Concatenate firstname (char1) + lastname
     $username = substr($demandToProcessContent["firstname"], 0, 1) . $demandToProcessContent["lastname"];
     // Low case all
     $username = strtolower($username);
     // Defining userDN
     $userDn = 'uid=' . $username . ', ou=people, ' . $this->container->getParameter('spirit_dev_d_box_user.ldap_driver.user.basedn');
     $userDn = str_replace(" ", "", $userDn);
     // Generating encoded SSHA Password
     $salt = base_convert(sha1(uniqid(mt_rand(), true)), 16, 36);
     $plainpasswd = Randomizer::generateRandomString(8);
     $encodedPassword = '******' . base64_encode(sha1($plainpasswd . $salt, TRUE) . $salt);
     // LDAP Encoded infos
     $newUserInfo['uid'] = $username;
     $newUserInfo['preferredLanguage'] = "fr_FR";
     $newUserInfo['gosaMailServer'] = "localhost";
     $newUserInfo['gosaVacationStart'] = (int) "1446559098";
     $newUserInfo['gosaVacationStop'] = (int) "1446559098";
     $newUserInfo['gosaMailDeliveryMode'] = ['none'];
     $newUserInfo['objectClass'][0] = "inetOrgPerson";
     $newUserInfo['objectClass'][1] = "organizationalPerson";
     $newUserInfo['objectClass'][2] = "person";
     $newUserInfo['objectClass'][3] = "gosaMailAccount";
     $newUserInfo['mail'] = $demandToProcessContent["user_mail"];
     $newUserInfo['givenName'] = ucfirst($demandToProcessContent["firstname"]);
     $newUserInfo['sn'] = ucfirst($demandToProcessContent["lastname"]);
     $newUserInfo['cn'] = ucfirst($demandToProcessContent["firstname"]) . " " . ucfirst($demandToProcessContent["lastname"]);
     $newUserInfo['userPassword'] = $encodedPassword;
     // Applying LDAP registration
     $ldapCreateUserIssue = $this->ldapDriver->ldapCreateUser($userDn, $newUserInfo);
     // If OK
     if ($ldapCreateUserIssue) {
         // Add some information to the array
         $newUserInfo['created'] = true;
         $newUserInfo['userDn'] = $userDn;
         $newUserInfo['clear_password'] = $plainpasswd;
     } else {
         $newUserInfo['created'] = false;
     }
     // Return with added infos to array
     return $newUserInfo;
 }
Beispiel #3
0
 /**
  * AutoProcess Project
  * @param Demand $demandToProcess
  * @param bool $flashbag
  * @return mixed
  */
 public function processNewProject(Demand $demandToProcess, $flashbag = true)
 {
     // Preparing return values
     $returnValues['processor'] = "project";
     $returnValues['demand_id'] = $demandToProcess->getId();
     // Process GitLabAPI project creation
     // Getting related project
     $projectId = $demandToProcess->getContent()["id"];
     $demandProject = $this->em->getRepository('SpiritDevDBoxPortalBundle:Project')->findOneBy(array('id' => $projectId));
     // Process VCS project creation
     if ($demandProject->isVcsManaged()) {
         $returnValues['slot'][] = $this->processVCSProjectCreation($demandProject);
     }
     // Process PM Project creation
     if ($demandProject->isPmManaged()) {
         $returnValues['slot'][] = $this->processPMProjectCreation($demandProject);
     }
     // Process CI Project creation
     if ($demandProject->isCiDevManaged()) {
         $returnValues['slot'][] = $this->processCIProjectCreation($demandProject);
     }
     // Process QA Project creation
     if ($demandProject->isQaDevManaged()) {
         $returnValues['slot'][] = $this->processQAProjectCreation($demandProject);
     }
     // Finalize Process
     $returnValues['slot'][] = $this->processProjectCreationFinalize($demandProject, $demandToProcess, $flashbag);
     // Adding todos
     $returnValues['slot'][] = $this->processProjectCreationTodos($demandProject);
     return $returnValues;
 }