コード例 #1
0
ファイル: Actions.php プロジェクト: nsine/webmail-lite
 /**
  * @return array
  */
 public function AjaxAccountDelete()
 {
     $bResult = false;
     $oAccount = $this->getDefaultAccountFromParam();
     $iAccountIDToDelete = (int) $this->oHttp->GetPost('AccountIDToDelete', 0);
     if (0 < $iAccountIDToDelete) {
         $oAccountToDelete = null;
         if ($oAccount->IdAccount === $iAccountIDToDelete) {
             $oAccountToDelete = $oAccount;
         } else {
             $oAccountToDelete = $this->oApiUsers->getAccountById($iAccountIDToDelete);
         }
         if ($oAccountToDelete instanceof \CAccount && $oAccountToDelete->IdUser === $oAccount->IdUser && !$oAccountToDelete->IsInternal && (0 < $oAccount->IdDomain && $oAccount->Domain->AllowUsersChangeEmailSettings || !$oAccount->IsDefaultAccount || 0 === $oAccount->IdDomain || -1 === $oAccount->IdDomain)) {
             $bResult = $this->oApiUsers->deleteAccount($oAccountToDelete);
         }
     }
     return $this->DefaultResponse($oAccount, __FUNCTION__, $bResult);
 }