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 attribute-level rights that may be 042 * described for an attribute in an entry retrieved with the get effective 043 * rights control. 044 */ 045 @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 046 public enum AttributeRight 047 { 048 /** 049 * The attribute right that indicates that the user has sufficient permission 050 * to perform search operations that target the associated attribute. 051 */ 052 SEARCH("search"), 053 054 055 056 /** 057 * The attribute right that indicates that the user has sufficient permission 058 * to read the values of the specified attribute. 059 */ 060 READ("read"), 061 062 063 064 /** 065 * The attribute right that indicates that the user has sufficient permission 066 * to make comparisons against the value of the specified attribute. 067 */ 068 COMPARE("compare"), 069 070 071 072 /** 073 * The attribute right that indicates that the user has sufficient permission 074 * to alter the values of the specified attribute. 075 */ 076 WRITE("write"), 077 078 079 080 /** 081 * The attribute right that indicates that the user has sufficient permission 082 * to add his or her own DN to the set of values for the specified attribute. 083 */ 084 SELFWRITE_ADD("selfwrite_add"), 085 086 087 088 /** 089 * The attribute right that indicates that the user has sufficient permission 090 * to remove his or her own DN from the set of values for the specified 091 * attribute. 092 */ 093 SELFWRITE_DELETE("selfwrite_delete"), 094 095 096 097 /** 098 * The attribute right that indicates that the user has sufficient permission 099 * to perform operations involving proxied authorization with the attribute. 100 */ 101 PROXY("proxy"); 102 103 104 105 // The name of this attribute right. 106 private final String name; 107 108 109 110 /** 111 * Creates a new attribute right with the specified name. 112 * 113 * @param name The name for this attribute right. 114 */ 115 private AttributeRight(final String name) 116 { 117 this.name = name; 118 } 119 120 121 122 /** 123 * Retrieves the name of this attribute right. 124 * 125 * @return The name of this attribute right. 126 */ 127 public String getName() 128 { 129 return name; 130 } 131 132 133 134 /** 135 * Retrieves the attribute right for the specified name. 136 * 137 * @param name The name for which to retrieve the corresponding attribute 138 * right. 139 * 140 * @return The requested attribute right, or {@code null} if there is no such 141 * right. 142 */ 143 public static AttributeRight forName(final String name) 144 { 145 final String lowerName = toLowerCase(name); 146 147 for (final AttributeRight r : EnumSet.allOf(AttributeRight.class)) 148 { 149 if (r.name.equals(lowerName)) 150 { 151 return r; 152 } 153 } 154 155 return null; 156 } 157 158 159 160 /** 161 * Retrieves a string representation of this attribute right. 162 * 163 * @return A string representation of this attribute right. 164 */ 165 @Override() 166 public String toString() 167 { 168 return name; 169 } 170 }