001package org.apache.fulcrum.security.model.dynamic.entity; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.Set; 023 024import org.apache.fulcrum.security.entity.Group; 025import org.apache.fulcrum.security.entity.Permission; 026import org.apache.fulcrum.security.entity.Role; 027import org.apache.fulcrum.security.util.GroupSet; 028import org.apache.fulcrum.security.util.PermissionSet; 029 030/** 031 * Represents the "simple" model where permissions are related to roles, roles 032 * are related to groups and groups are related to users, all in many to many 033 * relationships. 034 * 035 * @author <a href="mailto:epugh@upstate.com">Eric Pugh</a> 036 * @version $Id$ 037 */ 038public interface DynamicRole extends Role 039{ 040 /** 041 * Get the permission that are part of this role 042 * 043 * @return a set of permissions 044 */ 045 public PermissionSet getPermissions(); 046 047 /** 048 * Get the permission that are part of this role as Set 049 * 050 * @return a set of permissions 051 */ 052 public <T extends Permission> Set<T> getPermissionsAsSet(); 053 054 /** 055 * Set the permission that are part of this role 056 * 057 * @param permissionSet 058 * a set of permissions 059 */ 060 public void setPermissions(PermissionSet permissionSet); 061 062 /** 063 * Set the permission that are part of this role as Set 064 * 065 * @param permissions 066 * a set of permissions 067 */ 068 public <T extends Permission> void setPermissionsAsSet(Set<T> permissions); 069 070 /** 071 * This method should only be used by a RoleManager. Not directly. 072 * 073 * @param permission the Permission to add 074 */ 075 public void addPermission(Permission permission); 076 077 /** 078 * This method should only be used by a RoleManager. Not directly. 079 * 080 * @param permission the Permission to remove 081 */ 082 public void removePermission(Permission permission); 083 084 /** 085 * Get the groups this role belongs to 086 * 087 * @return a set of groups 088 */ 089 public GroupSet getGroups(); 090 091 /** 092 * Set the groups this role belongs to 093 * 094 * @param groups 095 * the set of groups 096 */ 097 public void setGroups(GroupSet groups); 098 099 /** 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}