1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
package org.openpermis.policy.bean.basic; |
11 | |
|
12 | |
import java.util.Collection; |
13 | |
import java.util.HashSet; |
14 | |
import java.util.List; |
15 | |
import java.util.Set; |
16 | |
|
17 | |
import org.openpermis.Subject; |
18 | |
import org.openpermis.policy.Role; |
19 | |
import org.openpermis.policy.RoleAssignmentRule; |
20 | |
import org.openpermis.policy.TimeStamp; |
21 | |
import org.openpermis.policy.bean.RoleAssignmentRuleBean; |
22 | |
import org.openpermis.policy.bean.RoleAssignmentRuleBeanCollection; |
23 | |
import org.openpermis.policy.bean.SerialNumber; |
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | 0 | public class BasicRoleAssignmentRuleCollection |
31 | |
extends BasicAbstractCollection<RoleAssignmentRuleBean> |
32 | |
implements RoleAssignmentRuleBeanCollection |
33 | |
{ |
34 | |
|
35 | |
|
36 | |
|
37 | |
private static final long serialVersionUID = -956620427014379243L; |
38 | |
|
39 | |
|
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
protected BasicRoleAssignmentRuleCollection (SerialNumber serialNumber) { |
49 | 266 | super(serialNumber); |
50 | 266 | } |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
|
57 | |
|
58 | |
protected BasicRoleAssignmentRuleCollection ( |
59 | |
SerialNumber serialNumber, |
60 | |
Collection<RoleAssignmentRuleBean> collection |
61 | |
) { |
62 | 249 | super(serialNumber, collection); |
63 | 248 | } |
64 | |
|
65 | |
|
66 | |
|
67 | |
|
68 | |
|
69 | |
|
70 | |
|
71 | |
|
72 | |
public Set<Role> verifyRoleAssignments ( |
73 | |
Subject subject, |
74 | |
Set<Role> assertedRoles, |
75 | |
TimeStamp timeStamp |
76 | |
) { |
77 | 11 | final Set<Role> result = new HashSet<Role>(); |
78 | 11 | for (RoleAssignmentRule roleAssignmentRule : this) { |
79 | 11 | result.addAll( |
80 | |
roleAssignmentRule.verifyRoleAssignment(subject, assertedRoles, timeStamp) |
81 | |
); |
82 | |
} |
83 | 11 | return result; |
84 | |
} |
85 | |
|
86 | |
|
87 | |
|
88 | |
|
89 | |
|
90 | |
|
91 | |
protected boolean isCollectionType (BasicPart part) { |
92 | 841 | return part instanceof RoleAssignmentRuleBeanCollection; |
93 | |
} |
94 | |
|
95 | |
|
96 | |
|
97 | |
|
98 | |
|
99 | |
|
100 | |
public BasicRoleAssignmentRuleCollection create (List<RoleAssignmentRuleBean> list) { |
101 | 0 | return new BasicRoleAssignmentRuleCollection(getSerialNumber().next(), list); |
102 | |
} |
103 | |
|
104 | |
} |