View Javadoc
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.PermissionSet;
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 TurbineRole extends Role, TurbineUserGroupRoleEntity
37  {
38      /**
39       * Get the permission that are part of this role
40       * 
41       * @return a set of permissions
42       */
43      public PermissionSet getPermissions();
44  
45      /**
46       * Get the permission that are part of this role as Set
47       * 
48       * @return a set of permissions
49       */
50      public <T extends Permission> Set<T> getPermissionsAsSet();
51  
52      /**
53       * Set the permission that are part of this role
54       * 
55       * @param permissionSet
56       *            a set of permissions
57       */
58      public void setPermissions(PermissionSet permissionSet);
59  
60      /**
61       * Set the permission that are part of this role as Set
62       * 
63       * @param permissions
64       *            a set of permissions
65       * @param <T> Permission
66       */
67      public <T extends Permission> void setPermissionsAsSet(Set<T> permissions);
68  
69      /**
70       * This method should only be used by a RoleManager. Not directly.
71       * 
72       * @param permission perm to add
73       */
74      public void addPermission(Permission permission);
75  
76      /**
77       * This method should only be used by a RoleManager. Not directly.
78       * 
79       * @param permission perm to remove
80       */
81      public void removePermission(Permission permission);
82  }