UnsuspendDomain.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Update;
  3. use ThurData\Servers\KerioEmail\App\Enums\Kerio;
  4. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\ApiService;
  5. use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Domain;
  6. /**
  7. *
  8. * Created by PhpStorm.
  9. * User: ThurData
  10. * Date: 10.10.19
  11. * Time: 15:21
  12. * Class UnsuspendDomain
  13. */
  14. class UnsuspendDomain extends ApiService
  15. {
  16. public function process()
  17. {
  18. $domain = $this->api->repository()->domains->getByName($this->formData['domain']);
  19. if(!$domain)
  20. {
  21. $this->setError($this->api->account->getLastResult()->getLastErrorCode());
  22. return false;
  23. }
  24. $domain->setAttrs([
  25. Domain::ATTR_DOMAIN_STATUS => Kerio::ACC_STATUS_ACTIVE,
  26. Domain::ATTR_MAIL_STATUS => Kerio::ENABLED,
  27. ]);
  28. $response = $this->api->domain->update($domain);
  29. if(!$response)
  30. {
  31. $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
  32. return false;
  33. }
  34. return true;
  35. }
  36. }