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