Remove isDomainDmarcRestricted
[MAILPOET-5782]
This commit is contained in:
committed by
Aschepikov
parent
7f6b66cf8f
commit
5735d21e4d
@@ -289,22 +289,6 @@ class Settings extends APIEndpoint {
|
|||||||
return $this->successResponse($response);
|
return $this->successResponse($response);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function checkDomainDmarcPolicy($data = []) {
|
|
||||||
$domain = $data['domain'] ?? null;
|
|
||||||
|
|
||||||
if (!$domain) {
|
|
||||||
return $this->badRequest([
|
|
||||||
APIError::BAD_REQUEST => __('No sender domain specified.', 'mailpoet'),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$domain = strtolower(trim($domain));
|
|
||||||
|
|
||||||
$response = ['isDmarcPolicyRestricted' => $this->senderDomainController->isDomainDmarcRestricted($domain)];
|
|
||||||
|
|
||||||
return $this->successResponse($response);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getAuthorizedSenderDomains($data = []) {
|
public function getAuthorizedSenderDomains($data = []) {
|
||||||
$domain = $data['domain'] ?? null;
|
$domain = $data['domain'] ?? null;
|
||||||
|
|
||||||
|
@@ -166,17 +166,6 @@ class AuthorizedSenderDomainController {
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Check Domain DMARC Policy
|
|
||||||
*
|
|
||||||
* returns `true` if domain has Restricted policy e.g. policy === reject or quarantine
|
|
||||||
* otherwise returns `false`
|
|
||||||
*/
|
|
||||||
public function isDomainDmarcRestricted(string $domain): bool {
|
|
||||||
$result = $this->getDmarcPolicyForDomain($domain);
|
|
||||||
return $result !== DmarcPolicyChecker::POLICY_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fetch Domain DMARC Policy
|
* Fetch Domain DMARC Policy
|
||||||
*
|
*
|
||||||
|
@@ -284,18 +284,6 @@ class AuthorizedSenderDomainControllerTest extends \MailPoetTest {
|
|||||||
$controller->verifyAuthorizedSenderDomain('testdomain.com');
|
$controller->verifyAuthorizedSenderDomain('testdomain.com');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testItReturnsTrueWhenDmarcIsEnabled() {
|
|
||||||
$controller = $this->getController();
|
|
||||||
$isRestricted = $controller->isDomainDmarcRestricted('mailpoet.com');
|
|
||||||
verify($isRestricted)->same(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItReturnsFalseWhenDmarcIsNotEnabled() {
|
|
||||||
$controller = $this->getController();
|
|
||||||
$isRestricted = $controller->isDomainDmarcRestricted('example.com');
|
|
||||||
verify($isRestricted)->same(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function testItReturnsDmarcStatus() {
|
public function testItReturnsDmarcStatus() {
|
||||||
$controller = $this->getController();
|
$controller = $this->getController();
|
||||||
$isRestricted = $controller->getDmarcPolicyForDomain('example.com');
|
$isRestricted = $controller->getDmarcPolicyForDomain('example.com');
|
||||||
|
Reference in New Issue
Block a user