comparison Lib/IMPL/Security/Role.pm @ 51:a1498298d3ee

Security in progress
author wizard@linux-odin.local
date Mon, 01 Mar 2010 17:25:36 +0300 (2010-03-01)
parents
children 2f31ecabe9ea
comparison
equal deleted inserted replaced
50:521c9c1a3ea1 51:a1498298d3ee
1 package IMPL::Security::Role;
2
3 use base qw(IMPL::Object);
4
5 use IMPL::Class::Property;
6
7 BEGIN {
8 public property roleName => prop_get;
9 public property parentRoles => prop_get;
10 }
11
12 sub CTOR {
13 my ($this,$name,$parentRoles) = @_;
14
15 $this->roleName($name);
16 $this->parentRoles($parentRoles);
17 }
18
19 sub Satisfy {
20 my ($this,@roles) = @_;
21
22 return 1 unless $this->_FilterRoles( @roles );
23 }
24
25 sub _FilterRoles {
26 my ($this,@roles) = @_;
27
28 @roles = grep not (ref $_ ? $this == $_ : $this->roleName eq $_), @roles;
29
30 @roles = $_->_FilterRoles(@roles) or return foreach @{$this->parentRoles} ;
31
32 return @roles;
33 }
34
35
36 1;
37
38 __END__
39
40 =pod
41
42 =head1 DESCRIPTION
43
44 ����. ����� �������� � ���� ������� ����.
45 ������� ����� ��� �������� ������� ����������� ����� � ������� ����.
46
47 =head1 MEMBERS
48
49 =over
50
51 =item C<roleName>
52
53 ��� ����, �� �������������
54
55 =item C<parentRoles>
56
57 ������ ������������ �����
58
59 =item C<Satisfy(@roles_list)>
60
61 ��������� ������� ����� ��������� ����� �� ������ @roles_list.
62 ����������� ������������� ��� ����� ��������, ��� � ���� �����.
63 ���������� 0 � ������ �������, 1 ��� ������� ����������� �����
64
65 =back
66
67 =cut