'.$domain->getName().'', XSD_ANYXML), ); $this->connection->cleanResponse(); $result = $this->connection ->cleanResponse() ->request("GetAllDistributionListsRequest", $params); return $result; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool|\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList */ public function read(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$list->getId().'', XSD_ANYXML), ); $result = $result = $this->connection ->cleanResponse() ->request("GetDistributionListRequest",$params); if($data = $result->getResponseBody()['GETDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($data); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool|\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList */ public function create(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getName(), "name"), ); $attrs = $list->getAttrs(); if($list->isDynamic()) { $params[] = new SoapParam(1, "dynamic"); unset($attrs['kerioDistributionListSendShareMessageToNewMembers']); } foreach($attrs as $key => $value) { $params[] = new SoapVar('' . $value . '', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("CreateDistributionListRequest",$params); $this->setLastResult($result); /** * load response to model */ if($accountData = $result->getResponseBody()['CREATEDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($accountData); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool|\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList */ public function update(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = [ new SoapParam($list->getId(), 'id') ]; $attrs = $list->getAttrs(); if($list->isDynamic()) { $params[] = new SoapParam(1, "dynamic"); unset($attrs['kerioDistributionListSendShareMessageToNewMembers']); } foreach($attrs as $key => $value) { $params[] = new SoapVar('' . $value . '', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("ModifyDistributionListRequest",$params); $this->setLastResult($result); if($data = $result->getResponseBody()['MODIFYDISTRIBUTIONLISTRESPONSE']['DL']) { $list->fill($data); return $list; } $this->setError($result->getLastError()); return false; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function delete(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); $result = $result = $this->connection ->cleanResponse() ->request("DeleteDistributionListRequest",$params); $this->setLastResult($result); if($result->getResponseBody()['DELETEDISTRIBUTIONLISTRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function addMembers(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); foreach($list->getMembers() as $val) { $params[] = new SoapVar(''.$val.'', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("AddDistributionListMemberRequest",$params); $this->setLastResult($result); if($result->getResponseBody()['ADDDISTRIBUTIONLISTMEMBERRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } public function deleteMembers(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), "id"), ); foreach($list->getMembers() as $val) { $params[] = new SoapVar(''.$val.'', XSD_ANYXML); } $result = $result = $this->connection ->cleanResponse() ->request("RemoveDistributionListMemberRequest",$params); return $result; } public function addOwners(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$list->getId().'', XSD_ANYXML), new SoapVar('', XSD_ANYXML), ); foreach($list->getOwners() as $owner) { $params[] = new SoapVar(''.$owner.'', XSD_ANYXML); } $params[] = new SoapVar('', XSD_ANYXML); $result = $this->connection ->cleanResponse() ->request("DistributionListActionRequest",$params); $this->setLastResult($result); if($result->getResponseBody()['DISTRIBUTIONLISTACTIONRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } public function deleteOwners(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapVar(''.$id.'', XSD_ANYXML), new SoapVar('', XSD_ANYXML), ); foreach($list->getOwners() as $owner) { $params[] = new SoapVar(''.$owner.'', XSD_ANYXML); } $params[] = new SoapVar('', XSD_ANYXML); $result = $result = $this->connection ->cleanResponse() ->request("DistributionListActionRequest",$params); //todo } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function addAlias(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), 'id'), new SoapParam($list->getAlias(), 'alias'), ); $result = $result = $this->connection ->cleanResponse() ->request("AddDistributionListAliasRequest",$params); $this->setLastResult($result); if($result->getResponseBody()['ADDDISTRIBUTIONLISTALIASRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } /** * @param \ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list * @return bool */ public function deleteAlias(\ThurData\Servers\KerioEmail\App\Libs\Kerio\Components\Api\Soap\Models\DistributionList $list) { $params = array( new SoapParam($list->getId(), 'id'), new SoapParam($list->getAlias(), 'alias'), ); $result = $result = $this->connection ->cleanResponse() ->request("RemoveDistributionListAliasRequest",$params); $this->setLastResult($result); if($result->getResponseBody()['REMOVEDISTRIBUTIONLISTALIASRESPONSE']) { return true; } $this->setError($result->getLastError()); return false; } }