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.Permission; 25 import org.apache.fulcrum.security.entity.Role; 26 import org.apache.fulcrum.security.util.RoleSet; 27 28 /** 29 * Represents the "simple" model where permissions are related to roles, roles 30 * are related to groups and groups are related to users, all in many to many 31 * relationships. 32 * 33 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a> 34 * @version $Id$ 35 */ 36 public interface DynamicPermission 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 */ 75 public <T extends Role> void setRolesAsSet(Set<T> roles); 76 77 /** 78 * Get the roles that this permission belongs to as Set 79 * 80 * @return a set of roles 81 */ 82 public <T extends Role> Set<T> getRolesAsSet(); 83 }