2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 package java.security.acl;
20 import java.security.Principal;
21 import java.util.Enumeration;
24 * The <i>Access Control List Entry</i> interface definition.
26 * An {@code AclEntry} is a list of the {@link Permission}s that are
27 * granted (<i>positive</i>) or denied (<i>negative</i>) to a {@link Principal}.
29 public interface AclEntry extends Cloneable {
32 * Set the principal for this ACL entry.
34 * The principal for an ACL entry can only be set once.
37 * the principal for this ACL entry.
38 * @return {@code true} on success, {@code false} if there is a principal already set for
41 boolean setPrincipal(Principal user);
44 * Returns the principal of this ACL entry.
46 * @return the principal of this ACL entry, or null if none is set.
48 Principal getPrincipal();
51 * Sets this ACL entry to be <i>negative</i>.
53 * The permissions in this ACL entry will be denied to the principal
54 * associated with this entry.
56 * Note: An ACL entry is <i>positive</i> by default and can only become
57 * <i>negative</i> by calling this method.
59 void setNegativePermissions();
62 * Returns whether this ACL entry is <i>negative</i>.
64 * @return {@code true} if this ACL entry is negative, {@code false} if it's positive.
69 * Adds the specified permission to this ACL entry.
72 * the permission to be added.
73 * @return {@code true} if the specified permission is added, {@code false} if the
74 * permission was already in this entry.
76 boolean addPermission(Permission permission);
79 * Removes the specified permission from this ACL entry.
82 * the permission to be removed.
83 * @return {@code true} if the permission is removed, {@code false} if the permission was
86 boolean removePermission(Permission permission);
89 * Checks whether the specified permission is in this ACL entry.
92 * the permission to check.
93 * @return {@code true} if the permission is in this entry, otherwise {@code false}.
95 boolean checkPermission(Permission permission);
98 * Returns the list of permissions of this ACL entry.
100 * @return the list of permissions of this ACL entry,
102 Enumeration<Permission> permissions();
105 * Returns the string representation of this ACL entry.
107 * @return the string representation of this ACL entry.
112 * Clones this ACL entry instance.
114 * @return a copy of this entry.