Mercurial > pub > Impl
comparison Lib/IMPL/Security.pm @ 230:6d8092d8ce1b
*reworked IMPL::Security
*reworked IMPL::Web::Security
*refactoring
author | sergey |
---|---|
date | Mon, 08 Oct 2012 03:37:37 +0400 |
parents | 4d0e1962161c |
children | 7c517134c42f |
comparison
equal
deleted
inserted
replaced
229:47f77e6409f7 | 230:6d8092d8ce1b |
---|---|
1 package IMPL::Security; | 1 package IMPL::Security; |
2 require IMPL::Security::Context; | 2 use strict; |
3 use Carp qw(carp); | |
4 | |
5 ##VERSION## | |
6 | |
7 require IMPL::Exception; | |
8 require IMPL::Security::AbstractContext; | |
3 require IMPL::Security::Rule::RoleCheck; | 9 require IMPL::Security::Rule::RoleCheck; |
4 | 10 |
5 our @rules = ( | 11 our @rules = ( |
6 \&IMPL::Security::Rule::RoleCheck::SatisfyAll | 12 \&IMPL::Security::Rule::RoleCheck::SatisfyAll |
7 ); | 13 ); |
9 our $authority = undef; | 15 our $authority = undef; |
10 | 16 |
11 sub AccessCheck { | 17 sub AccessCheck { |
12 my ($self, $object, $desiredAccess, $context) = @_; | 18 my ($self, $object, $desiredAccess, $context) = @_; |
13 | 19 |
14 $context ||= IMPL::Security::Context->contextCurrent; | 20 $context ||= IMPL::Security::AbstractContext->context; |
15 | 21 |
16 $_->() or return 0 foreach @{$self->Rules}; | 22 $_->() or return 0 foreach @{$self->Rules}; |
17 | 23 |
18 return 1; | 24 return 1; |
19 } | 25 } |