AclImpl.java revision 2362
2160N/A * Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 0N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 0N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 1472N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1472N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 0N/A * or visit www.oracle.com if you need additional information or have any 1879N/A * Represent an Access Control List (ACL) which is used to guard access to http adaptor. 1879N/A * It is a data structure with multiple ACL entries. Each ACL entry, of interface type 1879N/A * AclEntry, contains a set of permissions and a set of communities associated with a 1879N/A * particular principal. (A principal represents an entity such as a host or a group of host). 1879N/A * Additionally, each ACL entry is specified as being either positive or negative. 1879N/A * If positive, the permissions are to be granted to the associated principal. 2796N/A * If negative, the permissions are to be denied. 2796N/A * @see java.security.acl.Acl 113N/A * Constructs the ACL with a specified owner 0N/A * @param owner owner of the ACL. 0N/A * @param name name of this ACL. 0N/A * Sets the name of this ACL. 0N/A * @param caller the principal invoking this method. It must be an owner 0N/A * @param name the name to be given to this ACL. 0N/A * @exception NotOwnerException if the caller principal is not an owner 0N/A * @see java.security.Principal 0N/A * Returns the name of this ACL. 0N/A * @return the name of this ACL. 0N/A * Adds an ACL entry to this ACL. An entry associates a principal (e.g., an individual or a group) 0N/A * with a set of permissions. Each principal can have at most one positive ACL entry 0N/A * (specifying permissions to be granted to the principal) and one negative ACL entry 0N/A * (specifying permissions to be denied). If there is already an ACL entry 0N/A * of the same type (negative or positive) already in the ACL, false is returned. 0N/A * @param caller the principal invoking this method. It must be an owner 0N/A * @param entry the ACL entry to be added to this ACL. 0N/A * @return true on success, false if an entry of the same type (positive 0N/A * or negative) for the same principal is already present in this ACL. 0N/A * @exception NotOwnerException if the caller principal is not an owner of 0N/A * @see java.security.Principal 0N/A for (Enumeration e = entryList.elements();e.hasMoreElements();){ 0N/A AclEntry ent = (AclEntry) e.nextElement(); 0N/A if (ent.getPrincipal().equals(entry.getPrincipal())) 0N/A * Removes an ACL entry from this ACL. 0N/A * @param caller the principal invoking this method. It must be an owner 0N/A * @param entry the ACL entry to be removed from this ACL. 0N/A * @return true on success, false if the entry is not part of this ACL. 0N/A * @exception NotOwnerException if the caller principal is not an owner 0N/A * @see java.security.Principal 0N/A * @see java.security.acl.AclEntry 0N/A * Removes all ACL entries from this ACL. 0N/A * @param caller the principal invoking this method. It must be an owner 0N/A * @exception NotOwnerException if the caller principal is not an owner of 0N/A * @see java.security.Principal 0N/A * Returns an enumeration for the set of allowed permissions for 0N/A * the specified principal 0N/A * (representing an entity such as an individual or a group). 0N/A * This set of allowed permissions is calculated as follows: 0N/A * <LI>If there is no entry in this Access Control List for the specified 0N/A * principal, an empty permission set is returned.</LI> 2254N/A * <LI>Otherwise, the principal's group permission sets are determined. 2254N/A * (A principal can belong to one or more groups, where a group is a group 2254N/A * of principals, represented by the Group interface.)</LI> 2254N/A * @param user the principal whose permission set is to be returned. 0N/A * @return the permission set specifying the permissions the principal 0N/A * @see java.security.Principal 0N/A * Returns an enumeration of the entries in this ACL. Each element in the 0N/A * enumeration is of type AclEntry. 0N/A * @return an enumeration of the entries in this ACL. 0N/A * Checks whether or not the specified principal has the specified 0N/A * If it does, true is returned, otherwise false is returned. 0N/A * More specifically, this method checks whether the passed permission 0N/A * is a member of the allowed permission set of the specified principal. 0N/A * The allowed permission set is determined by the same algorithm as is 0N/A * used by the getPermissions method. 0N/A * @param user the principal, assumed to be a valid authenticated Principal. 0N/A * @param perm the permission to be checked for. 0N/A * @return true if the principal has the specified permission, 2254N/A * @see java.security.Principal 2254N/A * @see java.security.Permission 0N/A * Checks whether or not the specified principal has the specified 0N/A * If it does, true is returned, otherwise false is returned. 0N/A * More specifically, this method checks whether the passed permission 0N/A * is a member of the allowed permission set of the specified principal. 0N/A * The allowed permission set is determined by the same algorithm as is 0N/A * used by the getPermissions method. 0N/A * @param user the principal, assumed to be a valid authenticated Principal. 0N/A * @param community the community name associated with the principal. 0N/A * @param perm the permission to be checked for. 0N/A * @return true if the principal has the specified permission, false 0N/A * @see java.security.Principal 0N/A * @see java.security.Permission 304N/A * Checks whether or not the specified community string is defined. 0N/A * @param community the community name associated with the principal. 304N/A * @return true if the specified community string is defined, false 304N/A * @see java.security.Principal 0N/A * @see java.security.Permission 2254N/A * Returns a string representation of the ACL contents. 0N/A * @return a string representation of the ACL contents.