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