001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *     http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.apache.hadoop.fs.permission;
019
020import org.apache.hadoop.classification.InterfaceAudience;
021import org.apache.hadoop.classification.InterfaceStability;
022
023/**
024 * Specifies the type of an ACL entry.
025 */
026@InterfaceAudience.Public
027@InterfaceStability.Stable
028public enum AclEntryType {
029  /**
030   * An ACL entry applied to a specific user.  These ACL entries can be unnamed,
031   * which applies to the file owner, or named, which applies to the specific
032   * named user.
033   */
034  USER,
035
036  /**
037   * An ACL entry applied to a specific group.  These ACL entries can be
038   * unnamed, which applies to the file's group, or named, which applies to the
039   * specific named group.
040   */
041  GROUP,
042
043  /**
044   * An ACL mask entry.  Mask entries are unnamed.  During permission checks,
045   * the mask entry interacts with all ACL entries that are members of the group
046   * class.  This consists of all named user entries, the unnamed group entry,
047   * and all named group entries.  For each such entry, any permissions that are
048   * absent from the mask entry are removed from the effective permissions used
049   * during the permission check.
050   */
051  MASK,
052
053  /**
054   * An ACL entry that applies to all other users that were not covered by one
055   * of the more specific ACL entry types.
056   */
057  OTHER;
058
059  @Override
060  @InterfaceStability.Unstable
061  public String toString() {
062    // This currently just delegates to the stable string representation, but it
063    // is permissible for the output of this method to change across versions.
064    return toStringStable();
065  }
066
067  /**
068   * Returns a string representation guaranteed to be stable across versions to
069   * satisfy backward compatibility requirements, such as for shell command
070   * output or serialization.
071   *
072   * @return stable, backward compatible string representation
073   */
074  public String toStringStable() {
075    // The base implementation uses the enum value names, which are public API
076    // and therefore stable.
077    return super.toString();
078  }
079}