UpdateAccountPassword.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Update;
  3. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\ApiService;
  4. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Account;
  5. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Create\CreateAccountCosQuota;
  6. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Traits\ProductManagerHandler;
  7. /**
  8. *
  9. * Created by PhpStorm.
  10. * User: ThurData
  11. * Date: 08.11.19
  12. * Time: 12:15
  13. * Class UpdateAccountPassword
  14. */
  15. class UpdateAccountPassword extends ApiService
  16. {
  17. use ProductManagerHandler;
  18. /**
  19. * @return bool
  20. */
  21. public function isValid()
  22. {
  23. if(!$this->formData['id'])
  24. {
  25. $this->setError('Account Id name can not be found.');
  26. return false;
  27. }
  28. return parent::isValid(); // TODO: Change the autogenerated stub
  29. }
  30. /**
  31. * @return bool|mixed
  32. */
  33. public function process()
  34. {
  35. $model = new Account();
  36. $model->setId($this->formData['id']);
  37. $model->setPassword($this->formData['password']);
  38. $result = $this->api->account->setPassword($model);
  39. if(!$result)
  40. {
  41. $this->setError($this->api->account->getLastResult()->getLastErrorCode());
  42. return false;
  43. }
  44. return true;
  45. }
  46. }