summaryrefslogtreecommitdiff
path: root/lib/VNDB/Util/Auth.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2011-04-30 18:04:50 +0200
committerYorhel <git@yorhel.nl>2011-04-30 18:04:50 +0200
commit4873e8583189ee9c611fadd27d491dc104c52b57 (patch)
tree8c3b4e8b6f1c011e85f1ead078b7308b0863345e /lib/VNDB/Util/Auth.pm
parent57b464e826e5f24828dec9401b70baaa43410b6c (diff)
Replaced user ranks with a permission system
This is far more flexible.
Diffstat (limited to 'lib/VNDB/Util/Auth.pm')
-rw-r--r--lib/VNDB/Util/Auth.pm5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/VNDB/Util/Auth.pm b/lib/VNDB/Util/Auth.pm
index 88e68edc..89807bef 100644
--- a/lib/VNDB/Util/Auth.pm
+++ b/lib/VNDB/Util/Auth.pm
@@ -88,8 +88,7 @@ sub authInfo {
# a certain action. Argument is the action name as defined in global.pl
sub authCan {
my($self, $act) = @_;
- my $r = $self->{_auth} ? $self->{_auth}{rank} : 0;
- return scalar grep $_ eq $act, @{$self->{user_ranks}[$r]}[0..$#{$self->{user_ranks}[$r]}];
+ return $self->{_auth} ? $self->{_auth}{perm} & $self->{permissions}{$act} : 0;
}
@@ -102,7 +101,7 @@ sub _authCheck {
return 0 if !$user || length($user) > 15 || length($user) < 2 || !$pass;
my $d = $self->dbUserGet(username => $user, what => 'extended notifycount')->[0];
- return 0 if !defined $d->{id} || !$d->{rank};
+ return 0 if !$d->{id};
if(_authEncryptPass($self, $pass, $d->{salt}) eq $d->{passwd}) {
$self->{_auth} = $d;