diff options
Diffstat (limited to 'lib/VNWeb/Validation.pm')
-rw-r--r-- | lib/VNWeb/Validation.pm | 8 |
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}); |