summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-04-30 16:50:28 +0200
committerYorhel <git@yorhel.nl>2011-04-30 16:50:28 +0200
commit57b464e826e5f24828dec9401b70baaa43410b6c (patch)
treed5422908ec4d325a7ce9a0131321b74c6ee7e9c3
parent76b970a49e1d6374a3ec351debcf846ee00b78c0 (diff)
Cleaned up permissions
- Removed 'hist' and 'mod', weren't used at all - Merged 'del' and 'lock' into a single 'dbmod'
-rw-r--r--ChangeLog1
-rw-r--r--data/global.pl14
-rw-r--r--lib/VNDB/Handler/Affiliates.pm4
-rw-r--r--lib/VNDB/Handler/Chars.pm2
-rw-r--r--lib/VNDB/Handler/Misc.pm2
-rw-r--r--lib/VNDB/Handler/Producers.pm2
-rw-r--r--lib/VNDB/Handler/Releases.pm2
-rw-r--r--lib/VNDB/Handler/VNEdit.pm2
-rw-r--r--lib/VNDB/Util/CommonHTML.pm6
-rw-r--r--lib/VNDB/Util/FormHTML.pm6
10 files changed, 19 insertions, 22 deletions
diff --git a/ChangeLog b/ChangeLog
index d2b98f30..210880bf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,7 @@
- Added "Image ID" field to VN image uploader
- Added "All except characters" filter to history browser
- Cleaned up CSS code
+ - Cleaned up permissions
- Bugfix: don't accidentally remove char traits when editing
- Bugfix: fixed possible SQL table name clash on history browser
- Bugfix: properly announce chars and traits in Multi::IRC
diff --git a/data/global.pl b/data/global.pl
index c985b8ea..d19056f7 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -32,13 +32,13 @@ our %S = (%S,
ch_size => [ 256, 300 ], # max. w*h of char images
cv_size => [ 256, 400 ], # max. w*h of cover images
user_ranks => [
- # allowed actions # DB number
- [qw| hist |], # 0
- [qw| hist |], # 1
- [qw| hist board |], # 2
- [qw| hist board edit tag |], # 3
- [qw| hist board boardmod edit charedit tag mod lock del tagmod |], # 4
- [qw| hist board boardmod edit charedit tag mod lock del tagmod usermod affiliate |], # 5
+ # allowed actions # DB number
+ [qw| |], # 0
+ [qw| |], # 1
+ [qw| board |], # 2
+ [qw| board edit tag |], # 3
+ [qw| board boardmod edit charedit tag dbmod tagmod |], # 4
+ [qw| board boardmod edit charedit tag dbmod tagmod usermod affiliate |], # 5
],
languages => [qw|cs da de en es fi fr hu it ja ko nl no pl pt-br pt-pt ru sk sv tr vi zh|],
producer_types => [qw|co in ng|],
diff --git a/lib/VNDB/Handler/Affiliates.pm b/lib/VNDB/Handler/Affiliates.pm
index ac46c68d..679d6ee2 100644
--- a/lib/VNDB/Handler/Affiliates.pm
+++ b/lib/VNDB/Handler/Affiliates.pm
@@ -9,7 +9,7 @@ use VNDB::Func;
TUWF::register(
qr{affiliates} => \&list,
- qr{affiliates/del/([1-9]\d*)} => \&del,
+ qr{affiliates/del/([1-9]\d*)} => \&linkdel,
qr{affiliates/edit/([1-9]\d*)} => \&edit,
qr{affiliates/new} => \&edit,
);
@@ -86,7 +86,7 @@ sub list {
}
-sub del {
+sub linkdel {
my($self, $id) = @_;
return $self->htmlDenied if !$self->authCan('affiliate');
return if !$self->authCheckCode;
diff --git a/lib/VNDB/Handler/Chars.pm b/lib/VNDB/Handler/Chars.pm
index 347acb08..8edb6236 100644
--- a/lib/VNDB/Handler/Chars.pm
+++ b/lib/VNDB/Handler/Chars.pm
@@ -257,7 +257,7 @@ sub edit {
$rev = undef if !$r || $r->{cid} == $r->{latest};
return $self->htmlDenied if !$self->authCan('charedit')
- || $id && ($r->{locked} && !$self->authCan('lock') || $r->{hidden} && !$self->authCan('del'));
+ || $id && (($r->{locked} || $r->{hidden}) && !$self->authCan('dbmod'));
my %b4 = !$id ? () : (
(map +($_ => $r->{$_}), qw|name original alias desc image ihid ilock s_bust s_waist s_hip height weight bloodt gender main_spoil|),
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 167cc152..643af1cf 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -250,7 +250,7 @@ sub history {
end;
}
if(!$type || $type eq 'u') {
- if($self->authCan('del')) {
+ if($self->authCan('dbmod')) {
p class => 'browseopts';
a $f->{h} == 1 ? (class => 'optselected') : (), href => $u->(h => 1), mt '_hist_filter_hidedel';
a $f->{h} == -1 ? (class => 'optselected') : (), href => $u->(h => -1), mt '_hist_filter_showdel';
diff --git a/lib/VNDB/Handler/Producers.pm b/lib/VNDB/Handler/Producers.pm
index 5030c1a3..52db6edf 100644
--- a/lib/VNDB/Handler/Producers.pm
+++ b/lib/VNDB/Handler/Producers.pm
@@ -205,7 +205,7 @@ sub edit {
$rev = undef if !$p || $p->{cid} == $p->{latest};
return $self->htmlDenied if !$self->authCan('edit')
- || $pid && ($p->{locked} && !$self->authCan('lock') || $p->{hidden} && !$self->authCan('del'));
+ || $pid && (($p->{locked} || $p->{hidden}) && !$self->authCan('dbmod'));
my %b4 = !$pid ? () : (
(map { $_ => $p->{$_} } qw|type name original lang website desc alias ihid ilock|),
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 159b7c3f..dd2b278e 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -280,7 +280,7 @@ sub edit {
return $self->resNotFound if $vid && !$v->{id};
return $self->htmlDenied if !$self->authCan('edit')
- || $rid && ($r->{locked} && !$self->authCan('lock') || $r->{hidden} && !$self->authCan('del'));
+ || $rid && (($r->{locked} || $r->{hidden}) && !$self->authCan('dbmod'));
my $vn = $rid ? $r->{vn} : [{ vid => $vid, title => $v->{title} }];
my %b4 = !$rid ? () : (
diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm
index 8657a6f6..d0848c09 100644
--- a/lib/VNDB/Handler/VNEdit.pm
+++ b/lib/VNDB/Handler/VNEdit.pm
@@ -23,7 +23,7 @@ sub edit {
$rev = undef if !$vid || $v->{cid} == $v->{latest};
return $self->htmlDenied if !$self->authCan('edit')
- || $vid && ($v->{locked} && !$self->authCan('lock') || $v->{hidden} && !$self->authCan('del'));
+ || $vid && (($v->{locked} || $v->{hidden}) && !$self->authCan('dbmod'));
my $r = $v ? $self->dbReleaseGet(vid => $v->{id}) : [];
diff --git a/lib/VNDB/Util/CommonHTML.pm b/lib/VNDB/Util/CommonHTML.pm
index e1765d0d..5f2fb330 100644
--- a/lib/VNDB/Util/CommonHTML.pm
+++ b/lib/VNDB/Util/CommonHTML.pm
@@ -72,8 +72,8 @@ sub htmlMainTabs {
}
if( $type eq 'u' && ($self->authInfo->{id} && $obj->{id} == $self->authInfo->{id} || $self->authCan('usermod'))
- || $type =~ /[vrp]/ && $self->authCan('edit') && (!$obj->{locked} || $self->authCan('lock')) && (!$obj->{hidden} || $self->authCan('del'))
- || $type eq 'c' && $self->authCan('charedit') && (!$obj->{locked} || $self->authCan('lock')) && (!$obj->{hidden} || $self->authCan('del'))
+ || $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')
) {
li $sel eq 'edit' ? (class => 'tabselected') : ();
@@ -143,7 +143,7 @@ sub htmlHiddenMessage {
end;
end;
end 'div';
- return $self->htmlFooter() || 1 if !$self->authCan('del');
+ return $self->htmlFooter() || 1 if !$self->authCan('dbmod');
return 0;
}
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index 68b6a101..805467f6 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -214,15 +214,11 @@ sub htmlForm {
fieldset class => 'submit';
if($options->{editsum}) {
# hidden / locked checkbox
- if($self->authCan('del')) {
+ if($self->authCan('dbmod')) {
input type => 'checkbox', name => 'ihid', id => 'ihid', value => 1, $options->{frm}{ihid} ? (checked => 'checked') : ();
label for => 'ihid', mt '_form_ihid';
- }
- if($self->authCan('lock')) {
input type => 'checkbox', name => 'ilock', id => 'ilock', value => 1, $options->{frm}{ilock} ? (checked => 'checked') : ();
label for => 'ilock', mt '_form_ilock';
- }
- if($self->authCan('lock') || $self->authCan('del')) {
br; txt mt('_form_hidlock_note'); br;
}