summaryrefslogtreecommitdiff
path: root/lib/VNWeb/Validation.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2020-09-26 11:16:01 +0200
committerYorhel <git@yorhel.nl>2020-09-27 09:56:44 +0200
commitfc1a584b3253892eb563eb204c9a510ef71d04de (patch)
tree7b9c914cf386ebd6cf3872ec18601826fdcd2c33 /lib/VNWeb/Validation.pm
parent06325fde90ccf916e9ad8db69fa767bb3eaa7f19 (diff)
v2rw/TagEdit: Rewrite tag edit form to elm
It's still missing a few mod features, will add those later.
Diffstat (limited to 'lib/VNWeb/Validation.pm')
-rw-r--r--lib/VNWeb/Validation.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/VNWeb/Validation.pm b/lib/VNWeb/Validation.pm
index 4d398aac..e457aba2 100644
--- a/lib/VNWeb/Validation.pm
+++ b/lib/VNWeb/Validation.pm
@@ -182,6 +182,10 @@ sub validate_dbid {
# Otherwise, checks if the user can edit the review.
# Requires the 'uid' field.
#
+# g/i:
+# If no 'id' field, checks if the user can create a new tag/trait.
+# Otherwise, checks if the user can edit the entry.
+#
# 'dbentry_type's:
# If no 'id' field, checks whether the user can create a new entry.
# Otherwise, requires 'entry_hidden' and 'entry_locked' fields.
@@ -214,6 +218,10 @@ sub can_edit {
return auth && auth->uid == $entry->{user_id};
}
+ if($type eq 'g' || $type eq 'i') {
+ return auth && (auth->permTagmod || !$entry->{id});
+ }
+
die "Can't do authorization test when entry_hidden/entry_locked fields aren't present"
if $entry->{id} && (!exists $entry->{entry_hidden} || !exists $entry->{entry_locked});