mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2026-11-10 02:27:10 +00:00
[Web] Retention: last run for single rules, mode only when editing, check domain access first
This commit is contained in:
5 files changed
+44
-6
No files matched your search
@@ -71,7 +71,7 @@ class RetentionApiController
|
||||
{
|
||||
$id = $this->toId($id);
|
||||
$rule = ($id === null) ? null : $this->rules->get($id);
|
||||
return ($rule === null) ? [] : $this->rules->toArray($rule);
|
||||
return ($rule === null) ? [] : $this->rules->toArray($rule, $this->rules->lastRuns([$id])[$id] ?? null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -196,13 +196,14 @@ class RuleService
|
||||
/** @throws UserError */
|
||||
private function domainFor(mixed $value): string
|
||||
{
|
||||
$domain = strtolower((string)Input::text($value));
|
||||
$domain = Input::text($value);
|
||||
$domain = ($domain === null || $domain === '') ? '' : (string)idn_to_ascii(strtolower($domain), 0, INTL_IDNA_VARIANT_UTS46);
|
||||
if ($domain !== '' && !$this->context->hasAdminRights() && !$this->context->canAccessDomain($domain)) {
|
||||
throw new AccessDenied();
|
||||
}
|
||||
if ($domain === '' || !$this->repo->isDomain($domain)) {
|
||||
throw new UserError('domain_not_found', [htmlspecialchars((string)Input::text($value))]);
|
||||
}
|
||||
if (!$this->context->hasAdminRights() && !$this->context->canAccessDomain($domain)) {
|
||||
throw new AccessDenied();
|
||||
}
|
||||
return $domain;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user