Skip to content

Commit

Permalink
Improve admin check
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsonsfj committed Nov 21, 2008
1 parent 0868e1e commit baba312
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/MojoMojo/Controller/Jsrpc.pm
Expand Up @@ -200,8 +200,10 @@ Sets page permissions.
sub set_permissions : Local {
my ($self, $c) = @_;

my $user = $c->user;

# only admins can change permissions for now
unless ($c->user->is_admin) {
unless ($user && $user->is_admin) {
$c->res->body("Forbidden");
$c->res->status(403);
$c->detach;
Expand Down Expand Up @@ -273,8 +275,10 @@ Clears this page permissions for a given role (making permissions inherited).
sub clear_permissions : Local {
my ($self, $c) = @_;

my $user = $c->user;

# only admins can change permissions for now
unless ($c->user->is_admin) {
unless ($user && $user->is_admin) {
$c->res->body("Forbidden");
$c->res->status(403);
$c->detach;
Expand Down

0 comments on commit baba312

Please sign in to comment.