001 /*
002 * Copyright 2008-2015 UnboundID Corp.
003 * All Rights Reserved.
004 */
005 /*
006 * Copyright (C) 2015 UnboundID Corp.
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 */
021 package com.unboundid.ldap.sdk.unboundidds.controls;
022
023
024
025 import java.util.EnumSet;
026
027 import com.unboundid.util.ThreadSafety;
028 import com.unboundid.util.ThreadSafetyLevel;
029
030 import static com.unboundid.util.StaticUtils.*;
031
032
033
034 /**
035 * <BLOCKQUOTE>
036 * <B>NOTE:</B> This class is part of the Commercial Edition of the UnboundID
037 * LDAP SDK for Java. It is not available for use in applications that
038 * include only the Standard Edition of the LDAP SDK, and is not supported for
039 * use in conjunction with non-UnboundID products.
040 * </BLOCKQUOTE>
041 * This enum contains the set of possible entry-level rights that may be
042 * described in an entry retrieved with the get effective rights control.
043 */
044 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
045 public enum EntryRight
046 {
047 /**
048 * The entry right that indicates that the user has sufficient permission to
049 * add a subordinate of the target entry.
050 */
051 ADD("add"),
052
053
054
055 /**
056 * The entry right that indicates that the user has sufficient permission to
057 * delete the target entry.
058 */
059 DELETE("delete"),
060
061
062
063 /**
064 * The entry right that indicates that the user has sufficient permission to
065 * perform read operations with the entry.
066 */
067 READ("read"),
068
069
070
071 /**
072 * The entry right that indicates that the user has sufficient permission to
073 * perform write operations with the entry.
074 */
075 WRITE("write"),
076
077
078
079 /**
080 * The entry right that indicates that the user has sufficient permission to
081 * perform operations involving proxied authorization with the entry.
082 */
083 PROXY("proxy");
084
085
086
087 // The name of this entry right.
088 private final String name;
089
090
091
092 /**
093 * Creates a new entry right with the specified name.
094 *
095 * @param name The name for this entry right.
096 */
097 private EntryRight(final String name)
098 {
099 this.name = name;
100 }
101
102
103
104 /**
105 * Retrieves the name of this entry right.
106 *
107 * @return The name of this entry right.
108 */
109 public String getName()
110 {
111 return name;
112 }
113
114
115
116 /**
117 * Retrieves the entry right for the specified name.
118 *
119 * @param name The name for which to retrieve the corresponding entry right.
120 *
121 * @return The requested entry right, or {@code null} if there is no such
122 * right.
123 */
124 public static EntryRight forName(final String name)
125 {
126 final String lowerName = toLowerCase(name);
127
128 for (final EntryRight r : EnumSet.allOf(EntryRight.class))
129 {
130 if (r.name.equals(lowerName))
131 {
132 return r;
133 }
134 }
135
136 return null;
137 }
138
139
140
141 /**
142 * Retrieves a string representation of this entry right.
143 *
144 * @return A string representation of this entry right.
145 */
146 @Override()
147 public String toString()
148 {
149 return name;
150 }
151 }