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 import java.io.Serializable;
23
24 import org.apache.turbine.util.security.PermissionSet;
25 import org.apache.turbine.util.security.TurbineSecurityException;
26
27 /***
28 * This class represents a role played by the User associated with the
29 * current Session.
30 *
31 * @author <a href="mailto:frank.kim@clearink.com">Frank Y. Kim</a>
32 * @author <a href="mailto:john.mcnally@clearink.com">John D. McNally</a>
33 * @author <a href="mailto:bmclaugh@algx.net">Brett McLaughlin</a>
34 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
35 * @version $Id: Role.java 534527 2007-05-02 16:10:59Z tv $
36 */
37 public interface Role extends SecurityEntity, Serializable
38 {
39 /***
40 * Returns the set of Permissions associated with this Role.
41 *
42 * @return A PermissionSet.
43 * @exception Exception A generic exception.
44 */
45 PermissionSet getPermissions()
46 throws Exception;
47
48 /***
49 * Sets the Permissions associated with this Role.
50 *
51 * @param permissionSet A PermissionSet.
52 */
53 void setPermissions(PermissionSet permissionSet);
54
55
56
57 /***
58 * Creates a new Role in the system.
59 *
60 * @param name The name of the new Role.
61 * @return An object representing the new Role.
62 * @throws TurbineSecurityException if the Role could not be created.
63 */
64 Role create(String name)
65 throws TurbineSecurityException;
66
67 /***
68 * Makes changes made to the Role attributes permanent.
69 *
70 * @throws TurbineSecurityException if there is a problem while
71 * saving data.
72 */
73 void save()
74 throws TurbineSecurityException;
75
76 /***
77 * Removes a role from the system.
78 *
79 * @throws TurbineSecurityException if the Role could not be removed.
80 */
81 void remove()
82 throws TurbineSecurityException;
83
84 /***
85 * Renames the role.
86 *
87 * @param name The new Role name.
88 * @throws TurbineSecurityException if the Role could not be renamed.
89 */
90 void rename(String name)
91 throws TurbineSecurityException;
92
93 /***
94 * Grants a Permission to this Role.
95 *
96 * @param permission A Permission.
97 * @throws TurbineSecurityException if there is a problem while assigning
98 * the Permission.
99 */
100 void grant(Permission permission)
101 throws TurbineSecurityException;
102
103 /***
104 * Grants Permissions from a PermissionSet to this Role.
105 *
106 * @param permissionSet A PermissionSet.
107 * @throws TurbineSecurityException if there is a problem while assigning
108 * the Permissions.
109 */
110 void grant(PermissionSet permissionSet)
111 throws TurbineSecurityException;
112
113 /***
114 * Revokes a Permission from this Role.
115 *
116 * @param permission A Permission.
117 * @throws TurbineSecurityException if there is a problem while unassigning
118 * the Permission.
119 */
120 void revoke(Permission permission)
121 throws TurbineSecurityException;
122
123 /***
124 * Revokes Permissions from a PermissionSet from this Role.
125 *
126 * @param permissionSet A PermissionSet.
127 * @throws TurbineSecurityException if there is a problem while unassigning
128 * the Permissions.
129 */
130 void revoke(PermissionSet permissionSet)
131 throws TurbineSecurityException;
132 }