001 package org.apache.turbine.om.security;
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
022 import java.io.Serializable;
023
024 import org.apache.turbine.util.security.RoleSet;
025 import org.apache.turbine.util.security.TurbineSecurityException;
026
027 /**
028 * This class represents a Group of Users in the system that are associated
029 * with specific entity or resource. The users belonging to the Group may have
030 * various Roles. The Permissions to perform actions upon the resource depend
031 * on the Roles in the Group that they are assigned.
032 *
033 * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
034 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
035 * @version $Id: Group.java 957284 2010-06-23 17:53:31Z tv $
036 */
037 public interface Group extends SecurityEntity, Serializable
038 {
039 /**
040 * The name of the <a href="#global">global group</a>
041 */
042 String GLOBAL_GROUP_NAME = "global";
043
044 /**
045 * Makes changes made to the Group attributes permanent.
046 *
047 * @throws TurbineSecurityException if there is a problem while
048 * saving data.
049 */
050 void save()
051 throws TurbineSecurityException;
052
053 /**
054 * Removes a group from the system.
055 *
056 * @throws TurbineSecurityException if the Group could not be removed.
057 */
058 void remove()
059 throws TurbineSecurityException;
060
061 /**
062 * Renames the role.
063 *
064 * @param name The new Group name.
065 * @throws TurbineSecurityException if the Group could not be renamed.
066 */
067 void rename(String name)
068 throws TurbineSecurityException;
069
070 /**
071 * Grants a Role in this Group to an User.
072 *
073 * @param user An User.
074 * @param role A Role.
075 * @throws TurbineSecurityException if there is a problem while assigning
076 * the Role.
077 */
078 void grant(User user, Role role)
079 throws TurbineSecurityException;
080
081 /**
082 * Grants Roles in this Group to an User.
083 *
084 * @param user An User.
085 * @param roleSet A RoleSet.
086 * @throws TurbineSecurityException if there is a problem while assigning
087 * the Roles.
088 */
089 void grant(User user, RoleSet roleSet)
090 throws TurbineSecurityException;
091
092 /**
093 * Revokes a Role in this Group from an User.
094 *
095 * @param user An User.
096 * @param role A Role.
097 * @throws TurbineSecurityException if there is a problem while unassigning
098 * the Role.
099 */
100 void revoke(User user, Role role)
101 throws TurbineSecurityException;
102
103 /**
104 * Revokes Roles in this group from an User.
105 *
106 * @param user An User.
107 * @param roleSet a RoleSet.
108 * @throws TurbineSecurityException if there is a problem while unassigning
109 * the Roles.
110 */
111 void revoke(User user, RoleSet roleSet)
112 throws TurbineSecurityException;
113
114 }