diff options
author | Yorhel <git@yorhel.nl> | 2021-07-28 13:06:13 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2021-07-28 13:06:13 +0200 |
commit | fde850392cc8edcd7d498267577c8c4f17a15dda (patch) | |
tree | 7b4531cd72a8b3435961070d34d83123f5fe6c5c /lib | |
parent | 5ae9955a6016759355e1928372d1adff49c395ac (diff) |
Users: remove "imgmod" permission flag, use "dbmod" for that
Diffstat (limited to 'lib')
-rw-r--r-- | lib/VNWeb/Auth.pm | 4 | ||||
-rw-r--r-- | lib/VNWeb/Docs/Lib.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/Images/Vote.pm | 10 | ||||
-rw-r--r-- | lib/VNWeb/User/Edit.pm | 6 | ||||
-rw-r--r-- | lib/VNWeb/Validation.pm | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/lib/VNWeb/Auth.pm b/lib/VNWeb/Auth.pm index a6c4d852..3408db77 100644 --- a/lib/VNWeb/Auth.pm +++ b/lib/VNWeb/Auth.pm @@ -63,11 +63,11 @@ use overload bool => sub { defined shift->{user}{user_id} }; sub uid { shift->{user}{user_id} } sub user { shift->{user} } sub token { shift->{token} } -sub isMod { auth->permUsermod || auth->permDbmod || auth->permImgmod || auth->permBoardmod || auth->permTagmod } +sub isMod { auth->permUsermod || auth->permDbmod || auth->permBoardmod || auth->permTagmod } -my @perms = qw/board boardmod edit imgvote imgmod tag dbmod tagmod usermod review/; +my @perms = qw/board boardmod edit imgvote tag dbmod tagmod usermod review/; sub listPerms { @perms } diff --git a/lib/VNWeb/Docs/Lib.pm b/lib/VNWeb/Docs/Lib.pm index bea36241..9a0cb6f9 100644 --- a/lib/VNWeb/Docs/Lib.pm +++ b/lib/VNWeb/Docs/Lib.pm @@ -6,7 +6,7 @@ use VNDB::Skins; our @EXPORT = qw/enrich_html/; -my @special_perms = qw/boardmod dbmod usermod imgmod tagmod/; +my @special_perms = qw/boardmod dbmod usermod tagmod/; sub _moderators { my $cols = sql_comma map "perm_$_", @special_perms; diff --git a/lib/VNWeb/Images/Vote.pm b/lib/VNWeb/Images/Vote.pm index f6419e7c..5999fb3c 100644 --- a/lib/VNWeb/Images/Vote.pm +++ b/lib/VNWeb/Images/Vote.pm @@ -16,7 +16,7 @@ my $SEND = form_compile any => { }; -sub can_vote { auth->permImgmod || (auth->permImgvote && !global_settings->{lockdown_edit}) } +sub can_vote { auth->permDbmod || (auth->permImgvote && !global_settings->{lockdown_edit}) } # Fetch a list of images for the user to vote on. @@ -74,10 +74,10 @@ elm_api ImageVote => undef, { # Find out if any of these images are being overruled enrich_merge id => sub { sql 'SELECT id, bool_or(ignore) AS overruled FROM image_votes WHERE id IN', $_, 'GROUP BY id' }, $data->{votes}; enrich_merge id => sql('SELECT id, NOT ignore AS my_overrule FROM image_votes WHERE uid =', \auth->uid, 'AND id IN'), - grep $_->{overruled}, $data->{votes}->@* if auth->permImgmod; + grep $_->{overruled}, $data->{votes}->@* if auth->permDbmod; for($data->{votes}->@*) { - $_->{overrule} = 0 if !auth->permImgmod; + $_->{overrule} = 0 if !auth->permDbmod; my $d = { id => $_->{id}, uid => auth->uid(), @@ -102,7 +102,7 @@ sub imgflag_ { elm_ 'ImageFlagging', $SEND, { my_votes => my_votes(), nsfw_token => viewset(show_nsfw => 1), - mod => auth->permImgmod()||0, + mod => auth->permDbmod()||0, @_ }; } @@ -124,7 +124,7 @@ TUWF::get qr{/img/$RE{imgid}}, sub { my $id = tuwf->capture('id'); my $l = [{ id => $id }]; - enrich_image auth->permImgmod() || sub { defined $_[0]{my_sexual} }, $l; + enrich_image auth->permDbmod() || sub { defined $_[0]{my_sexual} }, $l; return tuwf->resNotFound if !defined $l->[0]{width}; framework_ title => "Image flagging for $id", sub { diff --git a/lib/VNWeb/User/Edit.pm b/lib/VNWeb/User/Edit.pm index 7406b8af..d04647ad 100644 --- a/lib/VNWeb/User/Edit.pm +++ b/lib/VNWeb/User/Edit.pm @@ -21,7 +21,6 @@ my $FORM = { perm_usermod => { _when => 'out', anybool => 1 }, perm_tagmod => { _when => 'out', anybool => 1 }, perm_boardmod => { _when => 'out', anybool => 1 }, - perm_imgmod => { _when => 'out', anybool => 1 }, } }, # Settings that require at least one perm_*mod @@ -77,7 +76,6 @@ TUWF::get qr{/$RE{uid}/edit}, sub { $u->{opts}{perm_usermod} = auth->permUsermod; $u->{opts}{perm_tagmod} = auth->permTagmod; $u->{opts}{perm_boardmod} = auth->permBoardmod; - $u->{opts}{perm_imgmod} = auth->permImgmod; $u->{prefs} = $u->{id} eq auth->uid || auth->permUsermod ? tuwf->dbRowi( @@ -88,7 +86,7 @@ TUWF::get qr{/$RE{uid}/edit}, sub { $u->{prefs}{email} = _getmail $u->{id} if $u->{prefs}; $u->{prefs}{skin} ||= config->{skin_default} if $u->{prefs}; - $u->{admin} = auth->permDbmod || auth->permUsermod || auth->permTagmod || auth->permBoardmod || auth->permImgmod ? + $u->{admin} = auth->permDbmod || auth->permUsermod || auth->permTagmod || auth->permBoardmod ? tuwf->dbRowi('SELECT ign_votes, ', sql_comma(map "perm_$_", auth->listPerms), 'FROM users u JOIN users_shadow us ON us.id = u.id WHERE u.id =', \$u->{id}) : undef; $u->{password} = undef; @@ -133,7 +131,7 @@ elm_api UserEdit => $FORM_OUT, $FORM_IN, sub { $set{perm_board} = $data->{admin}{perm_board} if auth->permBoardmod; $set{perm_review} = $data->{admin}{perm_review} if auth->permBoardmod; $set{perm_edit} = $data->{admin}{perm_edit} if auth->permDbmod; - $set{perm_imgvote} = $data->{admin}{perm_imgvote} if auth->permImgmod; + $set{perm_imgvote} = $data->{admin}{perm_imgvote} if auth->permDbmod; $set{perm_tag} = $data->{admin}{perm_tag} if auth->permTagmod; if($own && $data->{password}) { diff --git a/lib/VNWeb/Validation.pm b/lib/VNWeb/Validation.pm index 823fde01..9796351b 100644 --- a/lib/VNWeb/Validation.pm +++ b/lib/VNWeb/Validation.pm @@ -214,7 +214,7 @@ sub validate_dbid { sub can_edit { my($type, $entry) = @_; - return auth->permUsermod || auth->permDbmod || auth->permImgmod || auth->permBoardmod || auth->permTagmod || (auth && $entry->{id} eq auth->uid) if $type eq 'u'; + return auth->permUsermod || auth->permDbmod || auth->permBoardmod || auth->permTagmod || (auth && $entry->{id} eq auth->uid) if $type eq 'u'; return auth->permDbmod if $type eq 'd'; if($type eq 't') { |