Apache-AxKit-Plugin-Session
view release on metacpan or search on metacpan
lib/AxKit/XSP/Auth.pm view on Meta::CPAN
my $oldsession = $auth_type->_get_session_from_store($r,$old_id);
eval {
%$oldsession = ('_session_id' => $old_id);
tied(%$oldsession)->delete;
};
}
$$global{'auth_online_users'} ||= {};
$$global{'auth_online_users'}{$$session{'auth_access_user'}} = $$session{'_session_id'};
$$global{'auth_logins'}++;
}
throw Apache::AxKit::Exception::Retval(return_code => $rc) unless $attr_destination eq 'none';
EOC
}
sub logout : XSP_attribOrChild(destination)
{
return set_access(@_).<< 'EOC';
my $auth_type = $r->auth_type || 'Apache::AxKit::Plugin::Session';
no strict 'refs';
my $rc;
if (exists $$global{'auth_online_users'}{$$session{'auth_access_user'}}) {
delete $$global{'auth_online_users'}{$$session{'auth_access_user'}};
$$global{'auth_logouts'}++;
}
if (defined $attr_destination) {
$rc = $auth_type->logout($r,$attr_destination);
} else {
$rc = $auth_type->logout($r,$r->uri);
}
throw Apache::AxKit::Exception::Retval(return_code => $rc);
EOC
}
sub check_permission : XSP_attribOrChild(target,reason) XSP_childStruct($text(lang))
{
return 'if (do {'.has_permission(@_).'}) { '.deny_permission(@_).' }';
}
sub deny_permission : XSP_attribOrChild(reason) XSP_childStruct($text(lang))
{
return '$$session{"auth_reason"} = $attr_reason || "permission_denied"; $$session{"auth_reason_desc"} = $_{"text"}; throw Apache::AxKit::Exception::Retval(return_code => Apache::Constants::FORBIDDEN); ';
}
sub has_permission : XSP_attribOrChild(target) XSP_expr
{
return 'Apache::AxKit::Plugin::Session::has_permission($r,$attr_target)?1:0';
}
sub is_logged_in : XSP_expr
{
return '$$session{"auth_access_user"} ne "guest"?1:0';
( run in 0.932 second using v1.01-cache-2.11-cpan-496ff517765 )