| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Services\Update;
- use ThurData\Servers\KerioEmail\App\Enums\Kerio;
- use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Interfaces\ApiService;
- use ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\Domain;
- /**
- *
- * Created by PhpStorm.
- * User: ThurData
- * Date: 10.10.19
- * Time: 15:20
- * Class SuspendDomain
- */
- class SuspendDomain extends ApiService
- {
- public function isValid()
- {
- return parent::isValid();
- }
- public function process()
- {
- $domain = $this->api->repository()->domains->getByName($this->formData['domain']);
- if(!$domain)
- {
- $this->setError($this->api->account->getLastResult()->getLastErrorCode());
- return false;
- }
- $domain->setAttrs([
- Domain::ATTR_DOMAIN_STATUS => Kerio::ACC_STATUS_SUSPEND,
- Domain::ATTR_MAIL_STATUS => Kerio::DISABLED,
- ]);
- $response = $this->api->domain->update($domain);
- if(!$response)
- {
- $this->setError($this->api->domain->getLastResult()->getLastErrorCode());
- return false;
- }
- return true;
- }
- }
|