view Lib/IMPL/Security.pm @ 393:69a1f1508696

minor security refactoring
author cin
date Fri, 14 Feb 2014 16:41:12 +0400
parents d5c8b955bf8d
children
line wrap: on
line source

package IMPL::Security;
use strict;
use Carp qw(carp);

##VERSION##

require IMPL::Exception;
require IMPL::Security::Rule::RoleCheck;

use IMPL::require { 
    Principal => 'IMPL::Security::Principal',
    AbstractContext => 'IMPL::Security::AbstractContext',
    Context => 'IMPL::Security::Context'
};

sub principal {
    return
        AbstractContext->current
        && AbstractContext->current->principal
        || Principal->nobody; 
}

sub context {
    AbstractContext->current || Context->nobody;
}

1;

__END__