1 package org.apache.turbine.om.security;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 import org.apache.turbine.util.security.PermissionSet;
58 import org.apache.turbine.util.security.TurbineSecurityException;
59
60 /***
61 * This class represents a role played by the User associated with the
62 * current Session.
63 *
64 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
65 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
66 * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
67 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
68 * @version $Id: Role.java,v 1.4 2003/03/09 02:45:15 quintonm Exp $
69 */
70 public interface Role extends SecurityEntity
71 {
72 /***
73 * Returns the set of Permissions associated with this Role.
74 *
75 * @return A PermissionSet.
76 * @exception Exception A generic exception.
77 */
78 PermissionSet getPermissions()
79 throws Exception;
80
81 /***
82 * Sets the Permissions associated with this Role.
83 *
84 * @param permissionSet A PermissionSet.
85 */
86 void setPermissions(PermissionSet permissionSet);
87
88
89
90 /***
91 * Creates a new Role in the system.
92 *
93 * @param name The name of the new Role.
94 * @return An object representing the new Role.
95 * @throws TurbineSecurityException if the Role could not be created.
96 */
97 Role create(String name)
98 throws TurbineSecurityException;
99
100 /***
101 * Makes changes made to the Role attributes permanent.
102 *
103 * @throws TurbineSecurityException if there is a problem while
104 * saving data.
105 */
106 void save()
107 throws TurbineSecurityException;
108
109 /***
110 * Removes a role from the system.
111 *
112 * @throws TurbineSecurityException if the Role could not be removed.
113 */
114 void remove()
115 throws TurbineSecurityException;
116
117 /***
118 * Renames the role.
119 *
120 * @param name The new Role name.
121 * @throws TurbineSecurityException if the Role could not be renamed.
122 */
123 void rename(String name)
124 throws TurbineSecurityException;
125
126 /***
127 * Grants a Permission to this Role.
128 *
129 * @param permission A Permission.
130 * @throws TurbineSecurityException if there is a problem while assigning
131 * the Permission.
132 */
133 void grant(Permission permission)
134 throws TurbineSecurityException;
135
136 /***
137 * Grants Permissions from a PermissionSet to this Role.
138 *
139 * @param permissionSet A PermissionSet.
140 * @throws TurbineSecurityException if there is a problem while assigning
141 * the Permissions.
142 */
143 void grant(PermissionSet permissionSet)
144 throws TurbineSecurityException;
145
146 /***
147 * Revokes a Permission from this Role.
148 *
149 * @param permission A Permission.
150 * @throws TurbineSecurityException if there is a problem while unassigning
151 * the Permission.
152 */
153 void revoke(Permission permission)
154 throws TurbineSecurityException;
155
156 /***
157 * Revokes Permissions from a PermissionSet from this Role.
158 *
159 * @param permissionSet A PermissionSet.
160 * @throws TurbineSecurityException if there is a problem while unassigning
161 * the Permissions.
162 */
163 void revoke(PermissionSet permissionSet)
164 throws TurbineSecurityException;
165 }