diff options
author | Yorhel <git@yorhel.nl> | 2011-04-30 18:04:50 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-04-30 18:04:50 +0200 |
commit | 4873e8583189ee9c611fadd27d491dc104c52b57 (patch) | |
tree | 8c3b4e8b6f1c011e85f1ead078b7308b0863345e /lib/VNDB/Util | |
parent | 57b464e826e5f24828dec9401b70baaa43410b6c (diff) |
Replaced user ranks with a permission system
This is far more flexible.
Diffstat (limited to 'lib/VNDB/Util')
-rw-r--r-- | lib/VNDB/Util/Auth.pm | 5 | ||||
-rw-r--r-- | lib/VNDB/Util/LayoutHTML.pm | 1 |
2 files changed, 2 insertions, 4 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; diff --git a/lib/VNDB/Util/LayoutHTML.pm b/lib/VNDB/Util/LayoutHTML.pm index 5dd8038f..e1e21924 100644 --- a/lib/VNDB/Util/LayoutHTML.pm +++ b/lib/VNDB/Util/LayoutHTML.pm @@ -89,7 +89,6 @@ sub _menu { my $nc = $self->authInfo->{notifycount}; h2; a href => $uid, ucfirst $self->authInfo->{username}; - txt ' ('.mt('_urank_'.$self->authInfo->{rank}).')'; end; div; a href => "$uid/edit", mt '_menu_myprofile'; br; |