diff options
author | Yorhel <git@yorhel.nl> | 2014-10-16 14:55:53 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2014-10-16 14:55:53 +0200 |
commit | be93706e30414ce8c32d165844cb67895ef0c7d6 (patch) | |
tree | 63bda9912dc4bf5c5d0d1173d9c39103a319bde6 | |
parent | 73268c92ddbd791e8375cdfab6ccdd3fee01329e (diff) |
Completely get rid of the old charedit perm flag
-rw-r--r-- | data/global.pl | 4 | ||||
-rw-r--r-- | lib/VNDB/Handler/Chars.pm | 2 | ||||
-rw-r--r-- | lib/VNDB/Handler/Traits.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Handler/VNPage.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Util/CommonHTML.pm | 11 | ||||
-rw-r--r-- | lib/VNDB/Util/LayoutHTML.pm | 2 | ||||
-rw-r--r-- | util/updates/update_2.24.sql | 4 |
7 files changed, 16 insertions, 17 deletions
diff --git a/data/global.pl b/data/global.pl index 0e3dad3f..48dfd487 100644 --- a/data/global.pl +++ b/data/global.pl @@ -34,8 +34,8 @@ our %S = (%S, scr_size => [ 136, 102 ], # w*h of screenshot thumbnails ch_size => [ 256, 300 ], # max. w*h of char images cv_size => [ 256, 400 ], # max. w*h of cover images - # bit flags (TODO: completely merge charedit into edit) - permissions => {qw| board 1 boardmod 2 edit 4 charedit 4 tag 16 dbmod 32 tagmod 64 usermod 128 affiliate 256 |}, + # bit flags (Flag 8 was used for charedit, currently free for re-use) + permissions => {qw| board 1 boardmod 2 edit 4 tag 16 dbmod 32 tagmod 64 usermod 128 affiliate 256 |}, languages => [qw|ar cs da de en es fi fr he hu id it ja ko nl no pl pt-br pt-pt ro ru sk sv tr uk vi zh|], producer_types => [qw|co in ng|], discussion_boards => [qw|an db ge v p u|], # <- note that some properties of these boards are hard-coded diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm index 4c32c7bd..7ae95e43 100644 --- a/lib/VNDB/Handler/Chars.pm +++ b/lib/VNDB/Handler/Chars.pm @@ -255,7 +255,7 @@ sub edit { return $self->resNotFound if $id && !$r->{id}; $rev = undef if !$r || $r->{cid} == $r->{latest}; - return $self->htmlDenied if !$self->authCan('charedit') + return $self->htmlDenied if !$self->authCan('edit') || $id && (($r->{locked} || $r->{hidden}) && !$self->authCan('dbmod')); my %b4 = !$id ? () : ( diff --git a/lib/VNDB/Handler/Traits.pm b/lib/VNDB/Handler/Traits.pm index d71f6ddc..6cad44a0 100644 --- a/lib/VNDB/Handler/Traits.pm +++ b/lib/VNDB/Handler/Traits.pm @@ -57,7 +57,7 @@ sub traitpage { } div class => 'mainbox'; - a class => 'addnew', href => "/i$trait/add", mt '_traitp_addchild' if $self->authCan('charedit') && $t->{state} != 1; + a class => 'addnew', href => "/i$trait/add", mt '_traitp_addchild' if $self->authCan('edit') && $t->{state} != 1; h1 $title; parenttags($t, mt('_traitp_indexlink'), 'i'); @@ -132,7 +132,7 @@ sub traitedit { $trait = undef; } - return $self->htmlDenied if !$self->authCan('charedit') || $trait && !$self->authCan('tagmod'); + return $self->htmlDenied if !$self->authCan('edit') || $trait && !$self->authCan('tagmod'); my $t = $trait && $self->dbTraitGet(id => $trait, what => 'parents(1) addedby')->[0]; return $self->resNotFound if $trait && !$t; @@ -327,7 +327,7 @@ sub traitindex { $self->htmlHeader(title => mt '_traiti_title'); div class => 'mainbox'; - a class => 'addnew', href => "/i/new", mt '_traiti_create' if $self->authCan('charedit'); + a class => 'addnew', href => "/i/new", mt '_traiti_create' if $self->authCan('edit'); h1 mt '_traiti_search'; form action => '/i/list', 'accept-charset' => 'UTF-8', method => 'get'; $self->htmlSearchBox('i', ''); diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index 8eb4932f..f356731c 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -652,9 +652,7 @@ sub page { li class => 'left '.( $char ? ' tabselected' : ''); a href => "/v$v->{id}/chars#chars", name => 'chars', mt '_vnpage_tab_chars'; end; } if($self->authCan('edit')) { - if($self->authCan('charedit')) { - li; a href => "/c/new?vid=$v->{id}", mt '_vnpage_char_add'; end; - } + li; a href => "/c/new?vid=$v->{id}", mt '_vnpage_char_add'; end; li; a href => "/v$v->{id}/add", mt '_vnpage_rel_add'; end; } end; diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm index ac1944a9..d4bba99f 100644 --- a/lib/VNDB/Util/CommonHTML.pm +++ b/lib/VNDB/Util/CommonHTML.pm @@ -66,16 +66,15 @@ sub htmlMainTabs { end; } - if(($type eq 'r' && $self->authCan('edit') || $type eq 'c' && $self->authCan('charedit')) && $self->authInfo->{c_changes} > 0) { + if(($type =~ /[rc]/ && $self->authCan('edit')) && $self->authInfo->{c_changes} > 0) { li $sel eq 'copy' ? (class => 'tabselected') : (); a href => "/$id/copy", mt '_mtabs_copy'; end; } - if( $type eq 'u' && ($self->authInfo->{id} && $obj->{id} == $self->authInfo->{id} || $self->authCan('usermod')) - || $type =~ /[vrp]/ && $self->authCan('edit') && ((!$obj->{locked} && !$obj->{hidden}) || $self->authCan('dbmod')) - || $type eq 'c' && $self->authCan('charedit') && ((!$obj->{locked} && !$obj->{hidden}) || $self->authCan('dbmod')) - || $type =~ /[gi]/ && $self->authCan('tagmod') + if( $type eq 'u' && ($self->authInfo->{id} && $obj->{id} == $self->authInfo->{id} || $self->authCan('usermod')) + || $type =~ /[vrpc]/ && $self->authCan('edit') && ((!$obj->{locked} && !$obj->{hidden}) || $self->authCan('dbmod')) + || $type =~ /[gi]/ && $self->authCan('tagmod') ) { li $sel eq 'edit' ? (class => 'tabselected') : (); a href => "/$id/edit", mt '_mtabs_edit'; @@ -333,7 +332,7 @@ sub htmlItemMessage { p class => 'locked'; lit mt '_itemmsg_login', '/u/login'; end; - } elsif(!$self->authCan($type eq 'c' ? 'charedit' : 'edit')) { + } elsif(!$self->authCan('edit')) { p class => 'locked', mt '_itemmsg_denied'; } } diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm index 6471e8b1..07058b4f 100644 --- a/lib/VNDB/Util/LayoutHTML.pm +++ b/lib/VNDB/Util/LayoutHTML.pm @@ -102,8 +102,6 @@ sub _menu { if($self->authCan('edit')) { a href => '/v/add', mt '_menu_addvn'; br; a href => '/p/new', mt '_menu_addproducer'; br; - } - if($self->authCan('charedit')) { a href => '/c/new', mt '_menu_addcharacter'; br; } br; diff --git a/util/updates/update_2.24.sql b/util/updates/update_2.24.sql index 04d946f1..6bc33313 100644 --- a/util/updates/update_2.24.sql +++ b/util/updates/update_2.24.sql @@ -4,3 +4,7 @@ -- CREATE EXTENSION pgcrypto; UPDATE sessions SET token = digest(token, 'sha1'); -- DROP EXTENSION pgcrypto; + + +-- No more 'charedit' permission flag +UPDATE users SET perm = (perm & ~8); |