1 package org.apache.fulcrum.security.model.dynamic.entity;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.Set;
23
24 import org.apache.fulcrum.security.entity.Group;
25 import org.apache.fulcrum.security.entity.Permission;
26 import org.apache.fulcrum.security.entity.Role;
27 import org.apache.fulcrum.security.util.GroupSet;
28 import org.apache.fulcrum.security.util.PermissionSet;
29
30 /**
31 * Represents the "simple" model where permissions are related to roles, roles
32 * are related to groups and groups are related to users, all in many to many
33 * relationships.
34 *
35 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
36 * @version $Id$
37 */
38 public interface DynamicRole extends Role
39 {
40 /**
41 * Get the permission that are part of this role
42 *
43 * @return a set of permissions
44 */
45 public PermissionSet getPermissions();
46
47 /**
48 * Get the permission that are part of this role as Set
49 *
50 * @return a set of permissions
51 */
52 public <T extends Permission> Set<T> getPermissionsAsSet();
53
54 /**
55 * Set the permission that are part of this role
56 *
57 * @param permissionSet
58 * a set of permissions
59 */
60 public void setPermissions(PermissionSet permissionSet);
61
62 /**
63 * Set the permission that are part of this role as Set
64 *
65 * @param permissions
66 * a set of permissions
67 */
68 public <T extends Permission> void setPermissionsAsSet(Set<T> permissions);
69
70 /**
71 * This method should only be used by a RoleManager. Not directly.
72 *
73 * @param permission the Permission to add
74 */
75 public void addPermission(Permission permission);
76
77 /**
78 * This method should only be used by a RoleManager. Not directly.
79 *
80 * @param permission the Permission to remove
81 */
82 public void removePermission(Permission permission);
83
84 /**
85 * Get the groups this role belongs to
86 *
87 * @return a set of groups
88 */
89 public GroupSet getGroups();
90
91 /**
92 * Set the groups this role belongs to
93 *
94 * @param groups
95 * the set of groups
96 */
97 public void setGroups(GroupSet groups);
98
99 /**
100 * This method should only be used by a RoleManager. Not directly.
101 *
102 * @param group the Group to remove
103 */
104 public void removeGroup(Group group);
105
106 /**
107 * This method should only be used by a RoleManager. Not directly.
108 *
109 * @param group the Group to add
110 */
111 public void addGroup(Group group);
112
113 /**
114 * Set the groups this role belongs to as a Set
115 *
116 * @param groups
117 * the set of groups
118 */
119 public <T extends Group> void setGroupsAsSet(Set<T> groups);
120
121 /**
122 * Get the groups this role belongs to as a Set
123 *
124 * @return a set of groups
125 */
126 public <T extends Group> Set<T> getGroupsAsSet();
127 }