| | |
| | | import org.opends.server.loggers.debug.DebugLogger; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | |
| | | /** |
| | | * The SNMP User ACL. |
| | | * |
| | | */ |
| | | public class SNMPUserAcl implements UserAcl { |
| | | |
| | | /** |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = DebugLogger.getTracer(); |
| | | /** |
| | | * If * then all the users are allowed to access in read |
| | | * If * then all the users are allowed to access in read. |
| | | */ |
| | | private static final String ALL_USERS_ALLOWED = "*"; |
| | | /** |
| | |
| | | */ |
| | | private SNMPConnectionHandlerCfg currentConfig; |
| | | /** |
| | | * Configured hosts list |
| | | * Configured hosts list. |
| | | */ |
| | | private SortedSet usersList; |
| | | /** |
| | | * Configured traps destinations |
| | | * Configured traps destinations. |
| | | */ |
| | | private SortedSet trapDestinations; |
| | | /** |
| | | * Configured communities string |
| | | * Configured communities string. |
| | | */ |
| | | private SortedSet communityList; |
| | | /** |
| | | * Configured Security level |
| | | * Configured Security level. |
| | | */ |
| | | private SecurityLevel securityLevel; |
| | | /** |
| | |
| | | public SNMPUserAcl(SNMPConnectionHandlerCfg configuration) { |
| | | // Keep the configuration |
| | | this.currentConfig = configuration; |
| | | // Get the community/context string to accept |
| | | // Get the community/context string to accept |
| | | this.communityList = this.currentConfig.getCommunity(); |
| | | // Get the list of allowed users (SNMPV3) |
| | | this.usersList = this.currentConfig.getAllowedUser(); |
| | |
| | | int securityLevel) { |
| | | |
| | | // Special check for the defaultUser |
| | | if ((user.equals(this.templateUsername)) && (contextName.equals("null")) && ((this.securityLevel.ordinal() + 1) >= securityLevel)) { |
| | | if ((user.equals(this.templateUsername)) |
| | | && (contextName.equals("null")) |
| | | && ((this.securityLevel.ordinal() + 1) >= securityLevel)) { |
| | | return true; |
| | | } |
| | | |