Apache-SWIT-Security
view release on metacpan or search on metacpan
lib/Apache/SWIT/Security/Role/Manager.pm view on Meta::CPAN
my $perms = $uentry->{perms};
return unless (($perms && @$perms) || $uentry->{hook_func});
return bless({ _perms => $perms
, _hook_class => $uentry->{hook_class}
, _hook_func => $uentry->{hook_func}
}, $class);
}
sub check_user {
my ($self, $user, $req) = @_;
my %gids = map { ($_, 1) } ($user ? $user->role_ids : ());
my $res;
for my $p (@{ $self->{_perms} }) {
last if ($p == -1*Apache::SWIT::Security::Role::Manager::ALL);
if ($p == Apache::SWIT::Security::Role::Manager::ALL) {
$res = 1;
last;
}
next unless $gids{ abs($p) };
$res = 1 if $p > 0;
last;
}
return $res if $res;
my $hf = $self->{_hook_func} or return;
return $self->{_hook_class}->$hf($req);
}
1;
( run in 0.786 second using v1.01-cache-2.11-cpan-5735350b133 )