public function bind(\Nethgui\Controller\RequestInterface $request)
 {
     parent::bind($request);
     $currentUser = $this->getRequest()->getUser()->getCredential('username');
     if (isset($this->userName)) {
         $userExists = strlen($this->userName) > 0 && ($this->userName === 'root' || $this->getPlatform()->getDatabase('NethServer::Database::Passwd')->getType($this->userName) === 'passwd');
         if (!$userExists) {
             throw new \Nethgui\Exception\HttpException('Not found' . $this->userName, 404, 1322148399);
         }
         // The resource the current user is acting on is another user or
         // the current user oneself.  The policy decision point is delegated
         // to decide whether the current user has enough rights to change
         // the other user's password.  Refs #1580
         $resource = $currentUser === $this->userName ? 'Oneself' : 'SomeoneElse';
     } else {
         $this->userName = $currentUser;
         $resource = 'Oneself';
     }
     $response = $this->getPolicyDecisionPoint()->authorize($this->getRequest()->getUser(), $resource, self::ACTION_CHANGE_PASSWORD);
     if ($response->isDenied()) {
         throw $response->asException(1354619038);
     } elseif ($request->isMutation()) {
         $this->getLog()->notice(sprintf("%s: %s is changing password to %s (%s). %s", __CLASS__, $currentUser, $resource, $this->userName, $response->getMessage()));
         $this->stash->store($this->parameters['newPassword']);
     }
 }
 public function process()
 {
     if ($this->getRequest()->isMutation()) {
         $this->passwordStash->store($this->parameters['password']);
         $this->getPlatform()->signalEvent('nethserver-samba-adsjoin', array('-u', $this->parameters['login'], '-F', $this->passwordStash->getFilePath(), 'join'));
         // Check if join is OK:
         $this->isAuthNeeded = $this->getPlatform()->exec('/usr/bin/sudo /usr/libexec/nethserver/smbads test')->getExitCode() === 0 ? FALSE : TRUE;
     }
 }
 public function process()
 {
     parent::process();
     if ($this->getRequest()->isMutation()) {
         $this->stash->store($this->parameters['newPassword']);
         $this->getPlatform()->signalEvent('password-modify@post-process', array($this->userName, $this->stash->getFilePath()));
     }
 }