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 attribute-level rights that may be 034 * described for an attribute in an entry retrieved with the get effective 035 * rights control. 036 * <BR> 037 * <BLOCKQUOTE> 038 * <B>NOTE:</B> This class, and other classes within the 039 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 040 * supported for use against Ping Identity, UnboundID, and Alcatel-Lucent 8661 041 * server products. These classes provide support for proprietary 042 * functionality or for external specifications that are not considered stable 043 * or mature enough to be guaranteed to work in an interoperable way with 044 * other types of LDAP servers. 045 * </BLOCKQUOTE> 046 */ 047@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 048public enum AttributeRight 049{ 050 /** 051 * The attribute right that indicates that the user has sufficient permission 052 * to perform search operations that target the associated attribute. 053 */ 054 SEARCH("search"), 055 056 057 058 /** 059 * The attribute right that indicates that the user has sufficient permission 060 * to read the values of the specified attribute. 061 */ 062 READ("read"), 063 064 065 066 /** 067 * The attribute right that indicates that the user has sufficient permission 068 * to make comparisons against the value of the specified attribute. 069 */ 070 COMPARE("compare"), 071 072 073 074 /** 075 * The attribute right that indicates that the user has sufficient permission 076 * to alter the values of the specified attribute. 077 */ 078 WRITE("write"), 079 080 081 082 /** 083 * The attribute right that indicates that the user has sufficient permission 084 * to add his or her own DN to the set of values for the specified attribute. 085 */ 086 SELFWRITE_ADD("selfwrite_add"), 087 088 089 090 /** 091 * The attribute right that indicates that the user has sufficient permission 092 * to remove his or her own DN from the set of values for the specified 093 * attribute. 094 */ 095 SELFWRITE_DELETE("selfwrite_delete"), 096 097 098 099 /** 100 * The attribute right that indicates that the user has sufficient permission 101 * to perform operations involving proxied authorization with the attribute. 102 */ 103 PROXY("proxy"); 104 105 106 107 // The name of this attribute right. 108 private final String name; 109 110 111 112 /** 113 * Creates a new attribute right with the specified name. 114 * 115 * @param name The name for this attribute right. 116 */ 117 AttributeRight(final String name) 118 { 119 this.name = name; 120 } 121 122 123 124 /** 125 * Retrieves the name of this attribute right. 126 * 127 * @return The name of this attribute right. 128 */ 129 public String getName() 130 { 131 return name; 132 } 133 134 135 136 /** 137 * Retrieves the attribute right for the specified name. 138 * 139 * @param name The name for which to retrieve the corresponding attribute 140 * right. 141 * 142 * @return The requested attribute right, or {@code null} if there is no such 143 * right. 144 */ 145 public static AttributeRight forName(final String name) 146 { 147 switch (toLowerCase(name)) 148 { 149 case "search": 150 return SEARCH; 151 case "read": 152 return READ; 153 case "compare": 154 return COMPARE; 155 case "write": 156 return WRITE; 157 case "selfwriteadd": 158 case "selfwrite-add": 159 case "selfwrite_add": 160 case "self-write-add": 161 case "self_write_add": 162 return SELFWRITE_ADD; 163 case "selfwritedelete": 164 case "selfwrite-delete": 165 case "selfwrite_delete": 166 case "self-write-delete": 167 case "self_write_delete": 168 case "selfwritedel": 169 case "selfwrite-del": 170 case "selfwrite_del": 171 case "self-write-del": 172 case "self_write_del": 173 return SELFWRITE_DELETE; 174 case "proxy": 175 return PROXY; 176 default: 177 return null; 178 } 179 } 180 181 182 183 /** 184 * Retrieves a string representation of this attribute right. 185 * 186 * @return A string representation of this attribute right. 187 */ 188 @Override() 189 public String toString() 190 { 191 return name; 192 } 193}