annotate lib/IMPL/Security.pm @ 417:3ed0c58e9da3 ref20150831

working on di container, tests
author cin
date Mon, 02 Nov 2015 01:56:53 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Security;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use Carp qw(carp);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 ##VERSION##
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 require IMPL::Exception;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 require IMPL::Security::Rule::RoleCheck;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 use IMPL::require {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 Principal => 'IMPL::Security::Principal',
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 AbstractContext => 'IMPL::Security::AbstractContext',
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 Context => 'IMPL::Security::Context'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 sub principal {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 return
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 AbstractContext->current
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 && AbstractContext->current->principal
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 || Principal->nobody;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 sub context {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 AbstractContext->current || Context->nobody;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 1;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29 __END__