Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
PolicyBean |
|
| 1.0;1 |
1 | /* | |
2 | * Copyright (c) 2009, Swiss Federal Department of Defence Civil Protection and Sport | |
3 | * (http://www.vbs.admin.ch) | |
4 | * Copyright (c) 2009, Ergon Informatik AG (http://www.ergon.ch) | |
5 | * All rights reserved. | |
6 | * | |
7 | * Licensed under the Open Permis License which accompanies this distribution, | |
8 | * and is available at http://www.openpermis.org/BSDlicenceKent.txt | |
9 | */ | |
10 | package org.openpermis.policy.bean; | |
11 | ||
12 | import java.util.List; | |
13 | ||
14 | import org.joda.time.DateTimeZone; | |
15 | ||
16 | import org.openpermis.policy.Policy; | |
17 | import org.openpermis.policy.Role; | |
18 | ||
19 | ||
20 | /** | |
21 | * A policy for role-based access control. | |
22 | * <p>A policy defines two major sets of rules:</p> | |
23 | * <ul> | |
24 | * <li>Rules that allow certain subjects to assign some roles to other subjects (<em>role | |
25 | * assignment rules</em>).</li> | |
26 | * <li>Rules that define which roles have access to specific actions on specific resources | |
27 | * (<em>target access rules</em>).</li> | |
28 | * </ul> | |
29 | * <p>In order to be valid the following conditions must be met:</p> | |
30 | * <ul> | |
31 | * <li>The policy must have at least one {@link RoleAssignmentRuleBean}.</li> | |
32 | * <li>The policy must have at least one {@link TargetAccessRuleBean}.</li> | |
33 | * </ul> | |
34 | * <p>A policy defines role hierarchies. In order to be useful, polices must have at least one | |
35 | * {@link RoleHierarchyBean}.</p> | |
36 | * @since 0.1.0 | |
37 | */ | |
38 | public interface PolicyBean | |
39 | extends Policy, PartBean | |
40 | { | |
41 | ||
42 | //---- Methods | |
43 | ||
44 | /** | |
45 | * Returns the time zone of this policy. | |
46 | * @return the time zone of this policy. | |
47 | * @since 0.1.0 | |
48 | */ | |
49 | public DateTimeZone getDateTimeZone (); | |
50 | ||
51 | /** | |
52 | * Sets the time zone of this policy. | |
53 | * @param zone a {@link DateTimeZone}. | |
54 | * @since 0.1.0 | |
55 | */ | |
56 | public void setDateTimeZone (DateTimeZone zone); | |
57 | ||
58 | /** | |
59 | * Returns the role assignment rule collection of this policy. | |
60 | * @return the role assignment rule collection of this policy. | |
61 | * @since 0.3.0 | |
62 | */ | |
63 | public RoleAssignmentRuleBeanCollection getRoleAssignmentRules (); | |
64 | ||
65 | /** | |
66 | * Sets the role assignment rule collection of this policy. | |
67 | * @param roleAssignmentRules the new role assignment rule collection of this policy. | |
68 | * @since 0.3.0 | |
69 | */ | |
70 | public void setRoleAssignmentRules (RoleAssignmentRuleBeanCollection roleAssignmentRules); | |
71 | ||
72 | /** | |
73 | * Returns the target access rule collection of this policy. | |
74 | * @return the target access rule collection of this policy. | |
75 | * @since 0.3.0 | |
76 | */ | |
77 | public TargetAccessRuleBeanCollection getTargetAccessRules (); | |
78 | ||
79 | /** | |
80 | * Sets the target access rule collection of this policy. | |
81 | * @param targetAccessRules the new target access rule collection of this policy. | |
82 | * @since 0.3.0 | |
83 | */ | |
84 | public void setTargetAccessRules (TargetAccessRuleBeanCollection targetAccessRules); | |
85 | ||
86 | ||
87 | /** | |
88 | * Returns the role hierarchy collection of this policy. | |
89 | * @return the role hierarchy collection of this policy. | |
90 | * @since 0.3.0 | |
91 | */ | |
92 | public RoleHierarchyBeanCollection getRoleHierarchies (); | |
93 | ||
94 | /** | |
95 | * Sets the role hierarchy collection of this policy. | |
96 | * @param roleHierarchies the new role hierarchy collection of this policy. | |
97 | * @since 0.3.0 | |
98 | */ | |
99 | public void setRoleHierarchies (RoleHierarchyBeanCollection roleHierarchies); | |
100 | ||
101 | /** | |
102 | * Returns all parts of given type, unique by serial number. | |
103 | * @since 0.1.0 | |
104 | */ | |
105 | public <M extends PartBean> List<M> getPartsList (Class<M> type); | |
106 | ||
107 | /** | |
108 | * Returns the all subject domains of this.. | |
109 | * @return list of all subject domains of this. | |
110 | * @since 0.3.0 | |
111 | */ | |
112 | public List<DomainBean> getSubjectDomains (); | |
113 | ||
114 | /** | |
115 | * Returns the all resource domains of this.. | |
116 | * @return list of all resource domains of this. | |
117 | * @since 0.3.0 | |
118 | */ | |
119 | public List<DomainBean> getResourceDomains (); | |
120 | ||
121 | /** | |
122 | * Returns the PartBean's containing the given part. | |
123 | * @return list of found parts in the policy | |
124 | * @since 0.1.0 | |
125 | */ | |
126 | public List<TargetAccessRuleBean> getParentTargetAccessRules (TargetBean searchPart); | |
127 | ||
128 | /** | |
129 | * Returns the PartBean's containing the given part. | |
130 | * @return list of found parts in the policy | |
131 | * @since 0.3.0 | |
132 | */ | |
133 | public List<TargetAccessRuleBean> getParentTargetAccessRules (ObligationBean searchPart); | |
134 | ||
135 | /** | |
136 | * Returns the PartBean's containing the given part. | |
137 | * @param searchRole the role for which to return the rules that contain it. | |
138 | * @return list of found parts in the policy | |
139 | * @since 0.1.0 | |
140 | */ | |
141 | public List<TargetAccessRuleBean> getParentTargetAccessRules (Role searchRole); | |
142 | ||
143 | /** | |
144 | * Returns the PartBean's containing the given part. | |
145 | * @return list of found parts in the policy | |
146 | * @since 0.1.0 | |
147 | */ | |
148 | public List<TargetBean> getParentTargets (ActionBean searchPart); | |
149 | ||
150 | /** | |
151 | * Returns the PartBean's containing the given part. | |
152 | * @return list of found parts in the policy | |
153 | * @since 0.1.0 | |
154 | */ | |
155 | public List<TargetBean> getParentTargets (DomainBean searchPart); | |
156 | ||
157 | /** | |
158 | * Returns the PartBean's containing the given part. | |
159 | * @return list of found parts in the policy | |
160 | * @since 0.3.0 | |
161 | */ | |
162 | public List<RoleAssignmentRuleBean> getParentRoleAssignmentRules (DomainBean searchPart); | |
163 | ||
164 | /** | |
165 | * Returns all rolerefs. | |
166 | * @since 0.3.0 | |
167 | */ | |
168 | public List<Role> getRoleRefList (); | |
169 | ||
170 | } |