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