summaryrefslogtreecommitdiff
path: root/app/Http/RequestHandlers/CreateSourceAction.php
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2022-12-01 12:42:51 +0000
committerGreg Roach <greg@subaqua.co.uk>2022-12-01 12:43:09 +0000
commite3132a19b5bc5679ad08fb96ad3f19dbb09f5849 (patch)
tree568fe35061cfc13b0c279664405d9ed9aeb2c1ce /app/Http/RequestHandlers/CreateSourceAction.php
parent4c2188e419e716910897d0d969a178d28784c56a (diff)
downloadwebtrees-e3132a19b5bc5679ad08fb96ad3f19dbb09f5849.tar.gz
webtrees-e3132a19b5bc5679ad08fb96ad3f19dbb09f5849.tar.bz2
webtrees-e3132a19b5bc5679ad08fb96ad3f19dbb09f5849.zip
Fix: #4619 - cannot create new objects without a restriction
Diffstat (limited to 'app/Http/RequestHandlers/CreateSourceAction.php')
-rw-r--r--app/Http/RequestHandlers/CreateSourceAction.php6
1 files changed, 2 insertions, 4 deletions
diff --git a/app/Http/RequestHandlers/CreateSourceAction.php b/app/Http/RequestHandlers/CreateSourceAction.php
index 34e88a65ad..54b2fe7488 100644
--- a/app/Http/RequestHandlers/CreateSourceAction.php
+++ b/app/Http/RequestHandlers/CreateSourceAction.php
@@ -26,8 +26,6 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
-use function in_array;
-
/**
* Process a form to create a new source.
*/
@@ -48,7 +46,7 @@ class CreateSourceAction implements RequestHandlerInterface
$repository = Validator::parsedBody($request)->string('source-repository');
$call_number = Validator::parsedBody($request)->string('source-call-number');
$text = Validator::parsedBody($request)->string('source-text');
- $restriction = Validator::parsedBody($request)->string('restriction');
+ $restriction = Validator::parsedBody($request)->isInArray(['', 'NONE', 'PRIVACY', 'CONFIDENTIAL', 'LOCKED'])->string('restriction');
// Fix non-printing characters
$title = trim(preg_replace('/\s+/', ' ', $title));
@@ -87,7 +85,7 @@ class CreateSourceAction implements RequestHandlerInterface
}
}
- if (in_array($restriction, ['none', 'privacy', 'confidential', 'locked'], true)) {
+ if ($restriction !== '') {
$gedcom .= "\n1 RESN " . $restriction;
}