001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions Copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2006-2008 Sun Microsystems, Inc. 015 * Portions Copyright 2014-2016 ForgeRock AS. 016 */ 017package org.opends.server.types; 018 019import static org.opends.server.util.StaticUtils.*; 020 021/** 022 * This class implements an enumeration that holds the possible event 023 * types that can trigger an account status notification. 024 */ 025@org.opends.server.types.PublicAPI( 026 stability=org.opends.server.types.StabilityLevel.VOLATILE, 027 mayInstantiate=false, 028 mayExtend=false, 029 mayInvoke=true) 030public enum AccountStatusNotificationType 031{ 032 /** 033 * Indicates that an account status message should be generated 034 * whenever a user account has been temporarily locked after too 035 * many failed attempts. 036 */ 037 ACCOUNT_TEMPORARILY_LOCKED("account-temporarily-locked"), 038 /** 039 * Indicates that an account status message should be generated 040 * whenever a user account has been permanently locked after too 041 * many failed attempts. 042 */ 043 ACCOUNT_PERMANENTLY_LOCKED("account-permanently-locked"), 044 /** 045 * Indicates that an account status message should be generated 046 * whenever a user account has been unlocked by an administrator. 047 */ 048 ACCOUNT_UNLOCKED("account-unlocked"), 049 /** 050 * Indicates that an account status message should be generated 051 * whenever a user account has been locked because it was idle for 052 * too long. 053 */ 054 ACCOUNT_IDLE_LOCKED("account-idle-locked"), 055 /** 056 * Indicates that an account status message should be generated 057 * whenever a user account has been locked because it the password 058 * had been reset by an administrator but not changed by the user 059 * within the required interval. 060 */ 061 ACCOUNT_RESET_LOCKED("account-reset-locked"), 062 /** 063 * Indicates that an account status message should be generated 064 * whenever a user account has been disabled by an administrator. 065 */ 066 ACCOUNT_DISABLED("account-disabled"), 067 /** 068 * Indicates that an account status message should be generated 069 * whenever a user account has been enabled by an administrator. 070 */ 071 ACCOUNT_ENABLED("account-enabled"), 072 /** 073 * Indicates that an account status message should be generated 074 * whenever a user authentication has failed because the account 075 * has expired. 076 */ 077 ACCOUNT_EXPIRED("account-expired"), 078 079 /** 080 * Indicates that an account status notification message should be 081 * generated whenever a user authentication has failed because the 082 * password has expired. 083 */ 084 PASSWORD_EXPIRED("password-expired"), 085 /** 086 * Indicates that an account status notification message should be 087 * generated the first time that a password expiration warning is 088 * encountered for a user password. 089 */ 090 PASSWORD_EXPIRING("password-expiring"), 091 /** 092 * Indicates that an account status notification message should be 093 * generated whenever a user's password is reset by an 094 * administrator. 095 */ 096 PASSWORD_RESET("password-reset"), 097 /** 098 * Indicates whether an account status notification message should 099 * be generated whenever a user changes his/her own password. 100 */ 101 PASSWORD_CHANGED("password-changed"); 102 103 /** The notification type name. */ 104 private String name; 105 106 /** 107 * Creates a new account status notification type with the provided 108 * name. 109 * 110 * @param name The name for this account status notification type. 111 */ 112 private AccountStatusNotificationType(String name) 113 { 114 this.name = name; 115 } 116 117 /** 118 * Retrieves the account status notification type with the specified 119 * name. 120 * 121 * @param name The name for the account status notification type 122 * to retrieve. 123 * 124 * @return The requested account status notification type, or 125 * <CODE>null</CODE> if there is no type with the given 126 * name. 127 */ 128 public static AccountStatusNotificationType typeForName(String name) 129 { 130 switch (toLowerCase(name)) 131 { 132 case "account-temporarily-locked": 133 return ACCOUNT_TEMPORARILY_LOCKED; 134 case "account-permanently-locked": 135 return ACCOUNT_PERMANENTLY_LOCKED; 136 case "account-unlocked": 137 return ACCOUNT_UNLOCKED; 138 case "account-idle-locked": 139 return ACCOUNT_IDLE_LOCKED; 140 case "account-reset-locked": 141 return ACCOUNT_RESET_LOCKED; 142 case "account-disabled": 143 return ACCOUNT_DISABLED; 144 case "account-enabled": 145 return ACCOUNT_ENABLED; 146 case "account-expired": 147 return ACCOUNT_EXPIRED; 148 case "password-expired": 149 return PASSWORD_EXPIRED; 150 case "password-expiring": 151 return PASSWORD_EXPIRING; 152 case "password-reset": 153 return PASSWORD_RESET; 154 case "password-changed": 155 return PASSWORD_CHANGED; 156 default: 157 return null; 158 } 159 } 160 161 /** 162 * Retrieves the name for this account status notification type. 163 * 164 * @return The name for this account status notification type. 165 */ 166 public String getName() 167 { 168 return name; 169 } 170 171 @Override 172 public String toString() 173 { 174 return name; 175 } 176}