001/*
002 * Copyright 2008-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.controls;
022
023
024
025import com.unboundid.util.ThreadSafety;
026import com.unboundid.util.ThreadSafetyLevel;
027
028import static com.unboundid.util.StaticUtils.*;
029
030
031
032/**
033 * This enum contains the set of possible entry-level rights that may be
034 * described in an entry retrieved with the get effective rights control.
035 * <BR>
036 * <BLOCKQUOTE>
037 *   <B>NOTE:</B>  This class, and other classes within the
038 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
039 *   supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661
040 *   server products.  These classes provide support for proprietary
041 *   functionality or for external specifications that are not considered stable
042 *   or mature enough to be guaranteed to work in an interoperable way with
043 *   other types of LDAP servers.
044 * </BLOCKQUOTE>
045 */
046@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
047public enum EntryRight
048{
049  /**
050   * The entry right that indicates that the user has sufficient permission to
051   * add a subordinate of the target entry.
052   */
053  ADD("add"),
054
055
056
057  /**
058   * The entry right that indicates that the user has sufficient permission to
059   * delete the target entry.
060   */
061  DELETE("delete"),
062
063
064
065  /**
066   * The entry right that indicates that the user has sufficient permission to
067   * perform read operations with the entry.
068   */
069  READ("read"),
070
071
072
073  /**
074   * The entry right that indicates that the user has sufficient permission to
075   * perform write operations with the entry.
076   */
077  WRITE("write"),
078
079
080
081  /**
082   * The entry right that indicates that the user has sufficient permission to
083   * perform operations involving proxied authorization with the entry.
084   */
085  PROXY("proxy");
086
087
088
089  // The name of this entry right.
090  private final String name;
091
092
093
094  /**
095   * Creates a new entry right with the specified name.
096   *
097   * @param  name  The name for this entry right.
098   */
099  EntryRight(final String name)
100  {
101    this.name = name;
102  }
103
104
105
106  /**
107   * Retrieves the name of this entry right.
108   *
109   * @return  The name of this entry right.
110   */
111  public String getName()
112  {
113    return name;
114  }
115
116
117
118  /**
119   * Retrieves the entry right for the specified name.
120   *
121   * @param  name  The name for which to retrieve the corresponding entry right.
122   *
123   * @return  The requested entry right, or {@code null} if there is no such
124   *          right.
125   */
126  public static EntryRight forName(final String name)
127  {
128    switch (toLowerCase(name))
129    {
130      case "add":
131        return ADD;
132      case "delete":
133        return DELETE;
134      case "read":
135        return READ;
136      case "write":
137        return WRITE;
138      case "proxy":
139        return PROXY;
140      default:
141        return null;
142    }
143  }
144
145
146
147  /**
148   * Retrieves a string representation of this entry right.
149   *
150   * @return  A string representation of this entry right.
151   */
152  @Override()
153  public String toString()
154  {
155    return name;
156  }
157}