1 package org.apache.fulcrum.security.model.turbine.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.Permission;
25 import org.apache.fulcrum.security.entity.Role;
26 import org.apache.fulcrum.security.util.RoleSet;
27
28 /**
29 * Represents the "turbine" model where permissions are in a many to many
30 * relationship to roles, roles are related to groups are related to users, all
31 * in many to many relationships.
32 *
33 * @author <a href="mailto:epugh@upstate.com">Eric Pugh </a>
34 * @version $Id$
35 */
36 public interface TurbinePermission extends Permission
37 {
38 /**
39 * Get the roles that this permission belongs to
40 *
41 * @return a set of roles
42 */
43 public RoleSet getRoles();
44
45 /**
46 * Set the roles that this permission belongs to
47 *
48 * @param roleSet
49 * a set of roles
50 */
51 public void setRoles(RoleSet roleSet);
52
53 /**
54 * Add a role to this permission
55 *
56 * @param role
57 * the role to add
58 */
59 public void addRole(Role role);
60
61 /**
62 * Remove a role from this permission
63 *
64 * @param role
65 * the role to remove
66 */
67 public void removeRole(Role role);
68
69 /**
70 * Set the roles that this permission belongs to as Set
71 *
72 * @param roles
73 * a set of roles
74 * @param <T> Role
75 */
76 public <T extends Role> void setRolesAsSet(Set<T> roles);
77
78 /**
79 * Get the roles that this permission belongs to as Set
80 *
81 * @param <T>
82 * @return a set of roles
83 */
84 public <T extends Role> Set<T> getRolesAsSet();
85 }