DirectoryServer.java: Renamed getAttributeTypeOrDefault(String) to getAttributeType(String)
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeBuilder builder = new AttributeBuilder(attribute, true); |
| | | for (Object value : getAttributeValues(attrName)) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | AttributeBuilder builder = new AttributeBuilder(attribute, true); |
| | | for (Object value : csr.getAttributeValues(attrName)) |
| | | { |
| | |
| | | */ |
| | | public static String getRDNString(String attrName, String attrValue) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | RDN rdn = new RDN(attrType, attrName, ByteString.valueOfUtf8(attrValue)); |
| | | return rdn.toString(); |
| | | } |
| | |
| | | return; |
| | | } |
| | | |
| | | AttributeType attrType1 = DirectoryServer.getAttributeTypeOrDefault("adminport".toLowerCase()); |
| | | AttributeType attrType2 = DirectoryServer.getAttributeTypeOrDefault("adminEnabled".toLowerCase()); |
| | | AttributeType attrType1 = DirectoryServer.getAttributeType("adminport"); |
| | | AttributeType attrType2 = DirectoryServer.getAttributeType("adminEnabled"); |
| | | |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | mods.add(new Modification(ModificationType.REPLACE, Attributes.create(attrType1, adminPort))); |
| | |
| | | String val = getAttr("cn=LDAPS Connection Handler,cn=Connection Handlers,cn=config", "ds-cfg-enabled"); |
| | | if (val != null) |
| | | { |
| | | ldapsPortEnable = "true".equals(val.toLowerCase()); |
| | | ldapsPortEnable = "true".equalsIgnoreCase(val); |
| | | } |
| | | if (ldapPort == null && ldapsPort == null) |
| | | { |
| | |
| | | adminConnectorEntry = result.getFirst(); |
| | | } |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | |
| | | String name = value.trim(); |
| | | AttributeType type = isCheckSchema |
| | | ? DirectoryServer.getAttributeTypeOrNull(name) |
| | | : DirectoryServer.getAttributeTypeOrDefault(name); |
| | | : DirectoryServer.getAttributeType(name); |
| | | if (type == null) { |
| | | throw PropertyException.illegalPropertyValueException(this, value); |
| | | } |
| | |
| | | |
| | | // Now add the single RDN representing the named instance. |
| | | String type = profile.getRelationChildRDNType(r); |
| | | AttributeType atype = DirectoryServer.getAttributeTypeOrDefault(type.toLowerCase()); |
| | | AttributeType atype = DirectoryServer.getAttributeType(type); |
| | | ByteString avalue = ByteString.valueOfUtf8(name); |
| | | dn = dn.child(RDN.create(atype, avalue)); |
| | | } |
| | |
| | | |
| | | // Now add the single RDN representing the instance. |
| | | String type = profile.getRelationChildRDNType(r); |
| | | AttributeType atype = DirectoryServer.getAttributeTypeOrDefault(type.toLowerCase()); |
| | | AttributeType atype = DirectoryServer.getAttributeType(type); |
| | | ByteString avalue = ByteString.valueOfUtf8(d.getName()); |
| | | dn = dn.child(RDN.create(atype, avalue)); |
| | | } |
| | |
| | | // undefined. We should log a warning here if this is the case |
| | | // since the attribute should have been defined. |
| | | String attrID = LDAPProfile.getInstance().getAttributeName(d, pd); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(attrID); |
| | | AttributeType type = DirectoryServer.getAttributeType(attrID); |
| | | List<Attribute> attributes = configEntry.getEntry().getAttribute(type); |
| | | |
| | | List<ByteString> results = new LinkedList<>(); |
| | |
| | | { |
| | | // First check to see if the ds-pwp-password-policy-dn is present. |
| | | String userDNString = userEntry.getName().toString(); |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | for (Attribute a : userEntry.getAttribute(type)) |
| | | { |
| | | if (a.isEmpty()) |
| | |
| | | */ |
| | | public boolean isDisabled() |
| | | { |
| | | final AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_DISABLED); |
| | | final AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_ACCOUNT_DISABLED); |
| | | try |
| | | { |
| | | isDisabled = getBoolean(userEntry, type); |
| | |
| | | private AttributeDescription loadAttributeToMaps(final int id, final String attributeName, |
| | | final Iterable<String> attributeOptions, final Mappings mappings) |
| | | { |
| | | final AttributeType type = DirectoryServer.getAttributeTypeOrDefault(attributeName); |
| | | final AttributeType type = DirectoryServer.getAttributeType(attributeName); |
| | | final Set<String> options = getOptions(attributeOptions); |
| | | final AttributeDescription ad = AttributeDescriptions.create(type, options); |
| | | exclusiveLock.lock(); |
| | |
| | | } |
| | | else |
| | | { |
| | | nonRightsAttrs.add(DirectoryServer.getAttributeTypeOrDefault(a)); |
| | | nonRightsAttrs.add(DirectoryServer.getAttributeType(a)); |
| | | } |
| | | } |
| | | } |
| | |
| | | // Only add the aclRights information if the aclRights attribute type was seen. |
| | | if(hasAttrMask(mask, ACL_RIGHTS)) { |
| | | String typeStr = aclRightsAttributeLevelStr + ";" + a.getNameOrOID(); |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr); |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(typeStr); |
| | | Attribute attr = Attributes.create(attributeType, evalInfo.toString()); |
| | | //It is possible that the user might have specified the same attributes |
| | | //in both the search and the specific attribute part of the control. |
| | |
| | | if(hasAttrMask(mask,ACL_RIGHTS_INFO)) { |
| | | //Build the attribute type. |
| | | String typeStr = aclRightsInfoAttrLogsStr + ";" + rightStr + ";" + aType.getNameOrOID(); |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr); |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(typeStr); |
| | | Attribute attr = Attributes.create(attributeType, container.getEvalSummary()); |
| | | // The attribute type might have already been added, probably |
| | | // not but it is possible. |
| | |
| | | */ |
| | | private static void initStatics() |
| | | { |
| | | aciType = getAttributeTypeOrDefault("aci"); |
| | | globalAciType = getAttributeTypeOrDefault(ATTR_AUTHZ_GLOBAL_ACI); |
| | | debugSearchIndex = getAttributeTypeOrDefault(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | refAttrType = getAttributeTypeOrDefault(ATTR_REFERRAL_URL); |
| | | aciType = getAttributeType("aci"); |
| | | globalAciType = getAttributeType(ATTR_AUTHZ_GLOBAL_ACI); |
| | | debugSearchIndex = getAttributeType(SuffixContainer.ATTR_DEBUG_SEARCH_INDEX); |
| | | refAttrType = getAttributeType(ATTR_REFERRAL_URL); |
| | | |
| | | try |
| | | { |
| | |
| | | baseName = toLowerCase(rawAttributeType); |
| | | } |
| | | |
| | | container.setCurrentAttributeType(getAttributeTypeOrDefault(baseName)); |
| | | container.setCurrentAttributeType(getAttributeType(baseName)); |
| | | container.setCurrentAttributeValue(operation.getAssertionValue()); |
| | | return isAllowed(container, operation); |
| | | } |
| | |
| | | // Check to make sure that the backend has a presence index defined |
| | | // for the ACI attribute. If it does not, then log a warning message |
| | | // because this processing could be very expensive. |
| | | AttributeType aciType = DirectoryServer.getAttributeTypeOrDefault("aci"); |
| | | AttributeType aciType = DirectoryServer.getAttributeType("aci"); |
| | | if (backend.getEntryCount() > 0 |
| | | && !backend.isIndexed(aciType, IndexType.PRESENCE)) |
| | | { |
| | |
| | | * @return The attribute type. |
| | | */ |
| | | public AttributeType getAttributeType() { |
| | | return DirectoryServer.getAttributeTypeOrDefault(attrTypeStr.toLowerCase()); |
| | | return DirectoryServer.getAttributeType(attrTypeStr); |
| | | } |
| | | |
| | | /** |
| | |
| | | attributeName=attributeName.substring(0, semicolon); |
| | | } |
| | | String filterString=matcher.group(filterPos); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attributeName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attributeName); |
| | | SearchFilter filter; |
| | | //Check if it is a valid filter and add it to the list map if ok. |
| | | try { |
| | |
| | | throw new AciException(message); |
| | | } |
| | | } else { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attribute); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attribute); |
| | | if(attrType.isOperational()) |
| | | { |
| | | opAttributes.add(attrType); |
| | |
| | | private EnumEvalResult evalVAL(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched= EnumEvalResult.FALSE; |
| | | boolean undefined=false; |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrStr); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrStr); |
| | | final SearchRequest request = newSearchRequest(evalCtx.getClientDN(), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation op = getRootConnection().processSearch(request); |
| | | LinkedList<SearchResultEntry> result = op.getSearchEntries(); |
| | |
| | | private EnumEvalResult evalURL(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched= EnumEvalResult.FALSE; |
| | | boolean undefined=false; |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrStr); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrStr); |
| | | List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType); |
| | | if(!attrs.isEmpty()) { |
| | | for(Attribute a : attrs) { |
| | |
| | | int numEntries = 1; |
| | | |
| | | AttributeType backupPathType = |
| | | DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | |
| | | for (File dir : backupDirectories.keySet()) |
| | | { |
| | |
| | | Entry backupDirEntry = getBackupDirectoryEntry(entryDN); |
| | | |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a backup directory. |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | LinkedHashMap<AttributeType,List<Attribute>> userAttrs = new LinkedHashMap<>(3); |
| | | userAttrs.put(t, asList(t, v)); |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_BACKEND_DN); |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_BACKEND_DN); |
| | | userAttrs.put(t, asList(t, ByteString.valueOfUtf8(backupDirectory.getConfigEntryDN().toString()))); |
| | | |
| | | Entry e = new Entry(entryDN, ocMap, userAttrs, opAttrs); |
| | |
| | | throws DirectoryException |
| | | { |
| | | // First, get the backup ID from the entry DN. |
| | | AttributeType idType = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_ID); |
| | | AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID); |
| | | ByteString idValue = entryDN.rdn().getAttributeValue(idType); |
| | | if (idValue == null) { |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_ID_IN_DN.get(entryDN)); |
| | |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_PARENT_DN.get(entryDN)); |
| | | } |
| | | |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | ByteString v = parentDN.rdn().getAttributeValue(t); |
| | | if (v == null) { |
| | | throw newConstraintViolation(ERR_BACKUP_NO_BACKUP_DIR_IN_DN.get(entryDN)); |
| | |
| | | |
| | | Date backupDate = backupInfo.getBackupDate(); |
| | | if (backupDate != null) { |
| | | t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DATE); |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_DATE); |
| | | userAttrs.put(t, |
| | | asList(t, ByteString.valueOfUtf8(GeneralizedTimeSyntax.format(backupDate)))); |
| | | } |
| | |
| | | |
| | | HashSet<String> dependencies = backupInfo.getDependencies(); |
| | | if (dependencies != null && !dependencies.isEmpty()) { |
| | | t = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DEPENDENCY); |
| | | t = DirectoryServer.getAttributeType(ATTR_BACKUP_DEPENDENCY); |
| | | AttributeBuilder builder = new AttributeBuilder(t); |
| | | builder.addAllStrings(dependencies); |
| | | userAttrs.put(t, builder.toAttributeList()); |
| | |
| | | HashMap<String, String> properties = backupInfo.getBackupProperties(); |
| | | if (properties != null && !properties.isEmpty()) { |
| | | for (Map.Entry<String, String> e : properties.entrySet()) { |
| | | t = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(e.getKey())); |
| | | t = DirectoryServer.getAttributeType(toLowerCase(e.getKey())); |
| | | userAttrs.put(t, asList(t, ByteString.valueOfUtf8(e.getValue()))); |
| | | } |
| | | } |
| | |
| | | |
| | | private void putByteString(LinkedHashMap<AttributeType, List<Attribute>> userAttrs, String attrName, byte[] value) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType t = DirectoryServer.getAttributeType(attrName); |
| | | userAttrs.put(t, asList(t, ByteString.wrap(value))); |
| | | } |
| | | |
| | | private void putBoolean(LinkedHashMap<AttributeType, List<Attribute>> attrsMap, String attrName, boolean value) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType t = DirectoryServer.getAttributeType(attrName); |
| | | attrsMap.put(t, asList(t, createBooleanValue(value))); |
| | | } |
| | | |
| | |
| | | if (scope != SearchScope.BASE_OBJECT && !backupDirectories.isEmpty()) |
| | | { |
| | | AttributeType backupPathType = |
| | | DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | for (File dir : backupDirectories.keySet()) |
| | | { |
| | | // Check to see if the descriptor file exists. If not, then skip this |
| | |
| | | if (scope != SearchScope.BASE_OBJECT) |
| | | { |
| | | AttributeType t = |
| | | DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | DirectoryServer.getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | returnEntries(searchOperation, baseDN, filter, attrList); |
| | | } |
| | |
| | | { |
| | | File dir = new File(v.toString()); |
| | | BackupDirectory backupDirectory = backupDirectories.get(dir).getBackupDirectory(); |
| | | AttributeType idType = DirectoryServer.getAttributeTypeOrDefault(ATTR_BACKUP_ID); |
| | | AttributeType idType = DirectoryServer.getAttributeType(ATTR_BACKUP_ID); |
| | | |
| | | for (String backupID : backupDirectory.getBackups().keySet()) |
| | | { |
| | |
| | | |
| | | /** The attribute type for the "creatorsName" attribute. */ |
| | | private static final AttributeType CREATORS_NAME_TYPE = |
| | | DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC); |
| | | DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | /** The attribute type for the "modifiersName" attribute. */ |
| | | private static final AttributeType MODIFIERS_NAME_TYPE = |
| | | DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC); |
| | | DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | |
| | | /** The base DN for the external change log. */ |
| | | public static final DN CHANGELOG_BASE_DN; |
| | |
| | | private SearchFilter buildSearchFilterFrom(final DN baseDN, final String attrName) |
| | | { |
| | | final RDN rdn = baseDN.rdn(); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | final ByteString attrValue = rdn.getAttributeValue(attrType); |
| | | if (attrValue != null) |
| | | { |
| | |
| | | final Map<AttributeType, List<Attribute>> userAttrs, |
| | | final Map<AttributeType, List<Attribute>> operationalAttrs, final boolean addByType) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrNameUppercase); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrNameUppercase); |
| | | final Attribute a = addByType |
| | | ? Attributes.create(attrType, attrValue) |
| | | : Attributes.create(attrNameUppercase, attrValue); |
| | |
| | | */ |
| | | private Attribute createAttribute(String name, Collection<? extends Object> values) |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | AttributeType type = DirectoryServer.getAttributeType(name); |
| | | |
| | | AttributeBuilder builder = new AttributeBuilder(type, name); |
| | | builder.addAllStrings(values); |
| | |
| | | configEntryDN = configEntry.getDN(); |
| | | |
| | | // Get all of the attribute types that we will use for schema elements. |
| | | attributeTypesType = getAttributeTypeOrDefault(ATTR_ATTRIBUTE_TYPES_LC); |
| | | objectClassesType = getAttributeTypeOrDefault(ATTR_OBJECTCLASSES_LC); |
| | | matchingRulesType = getAttributeTypeOrDefault(ATTR_MATCHING_RULES_LC); |
| | | ldapSyntaxesType = getAttributeTypeOrDefault(ATTR_LDAP_SYNTAXES_LC); |
| | | ditContentRulesType = getAttributeTypeOrDefault(ATTR_DIT_CONTENT_RULES_LC); |
| | | ditStructureRulesType = getAttributeTypeOrDefault(ATTR_DIT_STRUCTURE_RULES_LC); |
| | | matchingRuleUsesType = getAttributeTypeOrDefault(ATTR_MATCHING_RULE_USE_LC); |
| | | nameFormsType = getAttributeTypeOrDefault(ATTR_NAME_FORMS_LC); |
| | | attributeTypesType = getAttributeType(ATTR_ATTRIBUTE_TYPES_LC); |
| | | objectClassesType = getAttributeType(ATTR_OBJECTCLASSES_LC); |
| | | matchingRulesType = getAttributeType(ATTR_MATCHING_RULES_LC); |
| | | ldapSyntaxesType = getAttributeType(ATTR_LDAP_SYNTAXES_LC); |
| | | ditContentRulesType = getAttributeType(ATTR_DIT_CONTENT_RULES_LC); |
| | | ditStructureRulesType = getAttributeType(ATTR_DIT_STRUCTURE_RULES_LC); |
| | | matchingRuleUsesType = getAttributeType(ATTR_MATCHING_RULE_USE_LC); |
| | | nameFormsType = getAttributeType(ATTR_NAME_FORMS_LC); |
| | | |
| | | // Initialize the lastmod attributes. |
| | | creatorsNameType = getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC); |
| | | createTimestampType = getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | modifiersNameType = getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = getAttributeTypeOrDefault(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | creatorsNameType = getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | createTimestampType = getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | modifiersNameType = getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | |
| | | // Construct the set of objectclasses to include in the schema entry. |
| | | schemaObjectClasses = new LinkedHashMap<>(3); |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | userAttrs.put(t, Attributes.createAsList(t, v)); |
| | | |
| | | |
| | | t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | t = DirectoryServer.getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | AttributeBuilder builder = new AttributeBuilder(t); |
| | | builder.setOption("binary"); |
| | | builder.add(certValue); |
| | |
| | | |
| | | if (scope != SearchScope.BASE_OBJECT && aliases.length != 0) |
| | | { |
| | | AttributeType certAliasType = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType certAliasType = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | for (String alias : aliases) |
| | | { |
| | | DN certDN = makeChildDN(this.baseDN, certAliasType, alias); |
| | |
| | | DN entryDN = entry.getName(); |
| | | |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Make sure that the DN specifies a certificate alias. |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID); |
| | | AttributeType t = DirectoryServer.getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | ByteString v = entryDN.rdn().getAttributeValue(t); |
| | | if (v == null) |
| | | { |
| | |
| | | private Attribute getSingleAttribute(Entry taskEntry, String attrName, Arg1<Object> noEntryErrorMsg, |
| | | Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | String messageString = buffer.toString(); |
| | | logMessages.add(messageString); |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_LOG_MESSAGES); |
| | | AttributeType type = DirectoryServer.getAttributeType(ATTR_TASK_LOG_MESSAGES); |
| | | |
| | | final List<Attribute> attrList = taskEntry.getAttribute(type); |
| | | ByteString value = ByteString.valueOfUtf8(messageString); |
| | |
| | | throws DirectoryException |
| | | { |
| | | // Get the name of the class that implements the task logic. |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_CLASS); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_CLASS); |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | */ |
| | | public ConfigAttribute getConfigAttribute(ConfigAttribute stub) throws ConfigException |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(stub.getName()); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(stub.getName()); |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | return !attrList.isEmpty() ? stub.getConfigAttribute(attrList) : null; |
| | | } |
| | |
| | | { |
| | | // It's possible that this is a monitor attribute rather than a configurable |
| | | // one. Check all of those. |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name); |
| | | for (MonitorProvider<? extends MonitorProviderCfg> monitor : monitorProviders) |
| | | { |
| | | for (org.opends.server.types.Attribute a : monitor.getMonitorData()) |
| | |
| | | |
| | | // It's possible that this is a monitor attribute rather than a |
| | | // configurable one. Check all of those. |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name); |
| | | |
| | | monitorLoop: |
| | | for (MonitorProvider<? extends MonitorProviderCfg> monitor : |
| | |
| | | reader.readStartSequence(); |
| | | while(reader.hasNextElement()) { |
| | | String attrStr = reader.readOctetStringAsString(); |
| | | attrs.add(DirectoryServer.getAttributeTypeOrDefault(attrStr)); |
| | | attrs.add(DirectoryServer.getAttributeType(attrStr)); |
| | | } |
| | | reader.readEndSequence(); |
| | | } |
| | |
| | | { |
| | | if (attributeType == null && rawAttributeType != null) |
| | | { |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(rawAttributeType); |
| | | attributeType = DirectoryServer.getAttributeType(rawAttributeType); |
| | | } |
| | | return attributeType; |
| | | } |
| | |
| | | baseName = toLowerCase(rawAttributeType); |
| | | attributeOptions = null; |
| | | } |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(baseName); |
| | | attributeType = DirectoryServer.getAttributeType(baseName); |
| | | } |
| | | |
| | | /** {@inheritDoc} */ |
| | |
| | | } |
| | | |
| | | /** |
| | | * Retrieves the attribute type for the provided lowercase name or OID. It |
| | | * Retrieves the attribute type for the provided name or OID. It |
| | | * can optionally return a generated "default" version if the requested |
| | | * attribute type is not defined in the schema. |
| | | * |
| | | * @param lowerName The lowercase name or OID for the attribute type to |
| | | * retrieve. |
| | | * @param nameOrOid The name or OID for the attribute type to retrieve. |
| | | * @return The requested attribute type, or <CODE>null</CODE> if there is no |
| | | * attribute with the specified type defined in the server schema and |
| | | * a default type should not be returned. |
| | | */ |
| | | public static AttributeType getAttributeTypeOrDefault(String lowerName) |
| | | public static AttributeType getAttributeType(String nameOrOid) |
| | | { |
| | | return getAttributeType(lowerName, getDefaultAttributeSyntax()); |
| | | return getAttributeType(nameOrOid, getDefaultAttributeSyntax()); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | private long getGeneralizedTime0(Entry userEntry, String attrName) throws DirectoryException |
| | | { |
| | | return getGeneralizedTime(userEntry, DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | return getGeneralizedTime(userEntry, DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | |
| | | /** |
| | |
| | | return authFailureTimes; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | try |
| | | { |
| | | authFailureTimes = getGeneralizedTimes(type); |
| | |
| | | failureTimes.add(highestFailureTime); |
| | | |
| | | // And the attribute in the user entry |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestFailureTime)); |
| | | modifications.add(new Modification(ModificationType.ADD, addAttr, true)); |
| | | |
| | |
| | | |
| | | failureTimes.clear(); // Note: failureTimes != this.authFailureTimes |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_FAILURE_TIME); |
| | | modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true)); |
| | | } |
| | | |
| | |
| | | return failureLockedTime; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | try |
| | | { |
| | | failureLockedTime = getGeneralizedTime(userEntry, type); |
| | |
| | | |
| | | failureLockedTime = time; |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | Attribute a = Attributes.create(type, GeneralizedTimeSyntax.format(failureLockedTime)); |
| | | modifications.add(new Modification(ModificationType.REPLACE, a, true)); |
| | | } |
| | |
| | | |
| | | failureLockedTime = -1L; |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_LOCKED_TIME); |
| | | modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true)); |
| | | } |
| | | |
| | |
| | | return false; |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | try |
| | | { |
| | | mustChangePassword = getBoolean(userEntry, type); |
| | |
| | | return; // requested state matches current state |
| | | } |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_RESET_REQUIRED); |
| | | this.mustChangePassword = ConditionResult.not(this.mustChangePassword); |
| | | if (mustChangePassword) |
| | | { |
| | |
| | | |
| | | this.warnedTime = warnedTime; |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_WARNED_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_WARNED_TIME); |
| | | Attribute a = Attributes.create(type, GeneralizedTimeSyntax.createGeneralizedTimeValue(currentTime)); |
| | | |
| | | modifications.add(new Modification(ModificationType.REPLACE, a, true)); |
| | |
| | | { |
| | | if (graceLoginTimes == null) |
| | | { |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | try |
| | | { |
| | | graceLoginTimes = getGeneralizedTimes(type); |
| | |
| | | long highestGraceTime = computeHighestTime(graceTimes); |
| | | graceTimes.add(highestGraceTime); // graceTimes == this.graceLoginTimes |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | Attribute addAttr = Attributes.create(type, GeneralizedTimeSyntax.format(highestGraceTime)); |
| | | modifications.add(new Modification(ModificationType.ADD, addAttr, true)); |
| | | } |
| | |
| | | } |
| | | graceTimes.clear(); // graceTimes == this.graceLoginTimes |
| | | |
| | | AttributeType type = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | AttributeType type = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_GRACE_LOGIN_TIME); |
| | | modifications.add(new Modification(ModificationType.REPLACE, Attributes.empty(type), true)); |
| | | } |
| | | |
| | |
| | | private TreeMap<Long,ByteString> getSortedHistoryValues(List<Attribute> removeAttrs) |
| | | { |
| | | TreeMap<Long, ByteString> historyMap = new TreeMap<>(); |
| | | AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | // If there is a maximum number of values to retain and we would be over the limit with the new value, |
| | | // then get rid of enough values (oldest first) to satisfy the count. |
| | | AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | int historyCount = passwordPolicy.getPasswordHistoryCount(); |
| | | if (historyCount > 0 && historyMap.size() >= historyCount) |
| | | { |
| | |
| | | public String[] getPasswordHistoryValues() |
| | | { |
| | | ArrayList<String> historyValues = new ArrayList<>(); |
| | | AttributeType historyType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | AttributeType historyType = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | objectClasses.containsKey(pwdValidatorPolicyOC)) |
| | | { |
| | | AttributeType pwdAttrType = |
| | | DirectoryServer.getAttributeTypeOrDefault(PWD_ATTR_VALIDATOR); |
| | | DirectoryServer.getAttributeType(PWD_ATTR_VALIDATOR); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | { |
| | | for (ByteString val : attr) |
| | |
| | | */ |
| | | private String getAttrValue(Entry entry, String pwdAttrName) |
| | | { |
| | | AttributeType pwdAttrType = DirectoryServer.getAttributeTypeOrDefault(pwdAttrName); |
| | | AttributeType pwdAttrType = DirectoryServer.getAttributeType(pwdAttrName); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | |
| | | ocCipherKey = DirectoryServer.getObjectClass(OC_CRYPTO_CIPHER_KEY, true); |
| | | ocMacKey = DirectoryServer.getObjectClass(OC_CRYPTO_MAC_KEY, true); |
| | | |
| | | attrCert = getAttributeTypeOrDefault(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrAlias = getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_ID); |
| | | attrCompromisedTime = getAttributeTypeOrDefault(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | attrCert = getAttributeType(ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | attrAlias = getAttributeType(ATTR_CRYPTO_KEY_ID); |
| | | attrCompromisedTime = getAttributeType(ATTR_CRYPTO_KEY_COMPROMISED_TIME); |
| | | |
| | | if (DirectoryServer.getBackendWithBaseDN(adminSuffixDN) != null) |
| | | { |
| | |
| | | } |
| | | |
| | | AttributeType privType = |
| | | DirectoryServer.getAttributeTypeOrDefault(ATTR_DEFAULT_ROOT_PRIVILEGE_NAME); |
| | | DirectoryServer.getAttributeType(ATTR_DEFAULT_ROOT_PRIVILEGE_NAME); |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | if (m.getAttribute().getAttributeType().equals(privType)) |
| | |
| | | // Get the memberURL attribute from the entry, if there is one, and parse |
| | | // out the LDAP URLs that it contains. |
| | | LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>(); |
| | | AttributeType memberURLType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER_URL_LC); |
| | | AttributeType memberURLType = DirectoryServer.getAttributeType(ATTR_MEMBER_URL_LC); |
| | | for (Attribute a : groupEntry.getAttribute(memberURLType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | if (certificateAttributeType == null) |
| | | { |
| | | certificateAttributeType = |
| | | DirectoryServer.getAttributeTypeOrDefault(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | } |
| | | |
| | | |
| | |
| | | if (newCertificateType == null) |
| | | { |
| | | newCertificateType = |
| | | DirectoryServer.getAttributeTypeOrDefault(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | DirectoryServer.getAttributeType(DEFAULT_VALIDATION_CERT_ATTRIBUTE); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | super(userEntry); |
| | | |
| | | this.cachedPasswordAttribute = DirectoryServer.getAttributeTypeOrDefault( |
| | | OP_ATTR_PTAPOLICY_CACHED_PASSWORD); |
| | | this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeTypeOrDefault( |
| | | OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME); |
| | | this.cachedPasswordAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD); |
| | | this.cachedPasswordTimeAttribute = DirectoryServer.getAttributeType(OP_ATTR_PTAPOLICY_CACHED_PASSWORD_TIME); |
| | | } |
| | | |
| | | |
| | |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message); |
| | | } |
| | | |
| | | someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER); |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER); |
| | | } |
| | | else if (hasGroupOfNamesClass) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message); |
| | | } |
| | | |
| | | someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MEMBER); |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_MEMBER); |
| | | } |
| | | else if (hasGroupOfUniqueNamesClass) |
| | | { |
| | | someMemberAttributeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_UNIQUE_MEMBER_LC); |
| | | someMemberAttributeType = DirectoryServer.getAttributeType(ATTR_UNIQUE_MEMBER_LC); |
| | | } |
| | | else |
| | | { |
| | |
| | | |
| | | // Get the target group DN attribute from the entry, if there is one. |
| | | DN targetDN = null; |
| | | AttributeType targetType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TARGET_GROUP_DN); |
| | | AttributeType targetType = DirectoryServer.getAttributeType(ATTR_TARGET_GROUP_DN); |
| | | for (Attribute a : groupEntry.getAttribute(targetType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | { |
| | | monitorName = backend.getBackendID() + " Backend"; |
| | | |
| | | backendIDType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_ID); |
| | | baseDNType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_BASE_DN); |
| | | entryCountType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_ENTRY_COUNT); |
| | | baseDNEntryCountType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BASE_DN_ENTRY_COUNT); |
| | | isPrivateType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_IS_PRIVATE); |
| | | writabilityModeType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_BACKEND_WRITABILITY_MODE); |
| | | backendIDType = DirectoryServer.getAttributeType(ATTR_MONITOR_BACKEND_ID); |
| | | baseDNType = DirectoryServer.getAttributeType(ATTR_MONITOR_BACKEND_BASE_DN); |
| | | entryCountType = DirectoryServer.getAttributeType(ATTR_MONITOR_BACKEND_ENTRY_COUNT); |
| | | baseDNEntryCountType = DirectoryServer.getAttributeType(ATTR_MONITOR_BASE_DN_ENTRY_COUNT); |
| | | isPrivateType = DirectoryServer.getAttributeType(ATTR_MONITOR_BACKEND_IS_PRIVATE); |
| | | writabilityModeType = DirectoryServer.getAttributeType(ATTR_MONITOR_BACKEND_WRITABILITY_MODE); |
| | | } |
| | | |
| | | @Override |
| | |
| | | { |
| | | monitorName = connectionHandler.getConnectionHandlerName(); |
| | | |
| | | connectionsType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_CONNECTION); |
| | | listenerType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_LISTENER); |
| | | numConnectionsType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_NUMCONNECTIONS); |
| | | protocolType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONNHANDLER_PROTOCOL); |
| | | configDnType = DirectoryServer.getAttributeTypeOrDefault(ATTR_MONITOR_CONFIG_DN); |
| | | connectionsType = DirectoryServer.getAttributeType(ATTR_MONITOR_CONNHANDLER_CONNECTION); |
| | | listenerType = DirectoryServer.getAttributeType(ATTR_MONITOR_CONNHANDLER_LISTENER); |
| | | numConnectionsType = DirectoryServer.getAttributeType(ATTR_MONITOR_CONNHANDLER_NUMCONNECTIONS); |
| | | protocolType = DirectoryServer.getAttributeType(ATTR_MONITOR_CONNHANDLER_PROTOCOL); |
| | | configDnType = DirectoryServer.getAttributeType(ATTR_MONITOR_CONFIG_DN); |
| | | } |
| | | |
| | | |
| | |
| | | /** Mandatory default constructor of this Directory Server plugin. */ |
| | | public EntryUUIDPlugin() |
| | | { |
| | | entryUUIDType = DirectoryServer.getAttributeTypeOrDefault(ENTRYUUID); |
| | | entryUUIDType = DirectoryServer.getAttributeType(ENTRYUUID); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | // Get the attribute types for the attributes that we will use. This needs |
| | | // to be done in the constructor in order to make the associated variables "final". |
| | | createTimestampType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | creatorsNameType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_CREATORS_NAME_LC); |
| | | modifiersNameType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | createTimestampType = DirectoryServer.getAttributeType(OP_ATTR_CREATE_TIMESTAMP_LC); |
| | | creatorsNameType = DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | modifiersNameType = DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | modifyTimestampType = DirectoryServer.getAttributeType(OP_ATTR_MODIFY_TIMESTAMP_LC); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | configuration.addPasswordPolicyImportChangeListener(this); |
| | | |
| | | customPolicyAttribute = |
| | | DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | customPolicyAttribute = DirectoryServer.getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | |
| | | |
| | | // Make sure that the plugin has been enabled for the appropriate types. |
| | |
| | | put(userAttrs, ATTR_SN, commonName); |
| | | put(userAttrs, ATTR_ROOTDN_ALTERNATE_BIND_DN, shortDNString); |
| | | |
| | | AttributeType privType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeBuilder builder = new AttributeBuilder(privType); |
| | | for (Privilege p : Privilege.getDefaultRootPrivileges()) |
| | | { |
| | |
| | | private void put(Map<AttributeType, List<Attribute>> Attrs, String attrName, String value) |
| | | { |
| | | List<Attribute> attrs = newLinkedList(Attributes.create(attrName, value)); |
| | | Attrs.put(DirectoryServer.getAttributeTypeOrDefault(attrName), attrs); |
| | | Attrs.put(DirectoryServer.getAttributeType(attrName), attrs); |
| | | } |
| | | |
| | | /** |
| | |
| | | if (semicolonPos > 0) |
| | | { |
| | | String baseName = attributeType.substring(0, semicolonPos); |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(baseName); |
| | | attrType = DirectoryServer.getAttributeType(baseName); |
| | | options = new HashSet<>(); |
| | | StringTokenizer tokenizer = |
| | | new StringTokenizer(attributeType.substring(semicolonPos+1), ";"); |
| | |
| | | else |
| | | { |
| | | options = null; |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(attributeType); |
| | | attrType = DirectoryServer.getAttributeType(attributeType); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | // This HistVal was used to store the date when some |
| | | // modifications were done to the entries. |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(attrString); |
| | | attrType = DirectoryServer.getAttributeType(attrString); |
| | | } |
| | | else |
| | | { |
| | |
| | | Set<AttributeType> includeAttributes = new HashSet<>(); |
| | | for (String attrName : includeAttributeStrings) |
| | | { |
| | | includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | includeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | exportConfig.setIncludeAttributes(includeAttributes); |
| | | } |
| | |
| | | |
| | | // Get the attribute that specifies which schema file(s) to add. |
| | | Entry taskEntry = getTaskEntry(); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_ADDSCHEMAFILE_FILENAME); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeBackupAll = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_ALL); |
| | | AttributeType typeCompress = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_COMPRESS); |
| | | AttributeType typeEncrypt = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_ENCRYPT); |
| | | AttributeType typeHash = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_HASH); |
| | | AttributeType typeIncremental = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_INCREMENTAL); |
| | | AttributeType typeSignHash = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_SIGN_HASH); |
| | | AttributeType typeBackendID = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_BACKEND_ID); |
| | | AttributeType typeBackupID = getAttributeTypeOrDefault(ATTR_BACKUP_ID); |
| | | AttributeType typeBackupDirectory = getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typeIncrementalBaseID = getAttributeTypeOrDefault(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID); |
| | | AttributeType typeBackupAll = getAttributeType(ATTR_TASK_BACKUP_ALL); |
| | | AttributeType typeCompress = getAttributeType(ATTR_TASK_BACKUP_COMPRESS); |
| | | AttributeType typeEncrypt = getAttributeType(ATTR_TASK_BACKUP_ENCRYPT); |
| | | AttributeType typeHash = getAttributeType(ATTR_TASK_BACKUP_HASH); |
| | | AttributeType typeIncremental = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL); |
| | | AttributeType typeSignHash = getAttributeType(ATTR_TASK_BACKUP_SIGN_HASH); |
| | | AttributeType typeBackendID = getAttributeType(ATTR_TASK_BACKUP_BACKEND_ID); |
| | | AttributeType typeBackupID = getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typeIncrementalBaseID = getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID); |
| | | |
| | | backUpAll = TaskUtils.getBoolean(taskEntry.getAttribute(typeBackupAll), false); |
| | | compress = TaskUtils.getBoolean(taskEntry.getAttribute(typeCompress), false); |
| | |
| | | |
| | | private long getConnectionID(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_CONN_ID); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT); |
| | | final AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | private LocalizableMessage getDisconnectMessage(Entry taskEntry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_TASK_DISCONNECT_MESSAGE); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | AttributeType typeWrapColumn = getAttributeTypeOrDefault(ATTR_TASK_EXPORT_WRAP_COLUMN); |
| | | AttributeType typeWrapColumn = getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN); |
| | | |
| | | ldifFile = toString(taskEntry, ATTR_TASK_EXPORT_LDIF_FILE); |
| | | File f = new File (ldifFile); |
| | |
| | | |
| | | private boolean toBoolean(Entry entry, boolean defaultValue, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeTypeOrDefault(attrName); |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getBoolean(attrs, defaultValue); |
| | | } |
| | | |
| | | private ArrayList<String> toListOfString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeTypeOrDefault(attrName); |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getMultiValueString(attrs); |
| | | } |
| | | |
| | | private String toString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeTypeOrDefault(attrName); |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | return TaskUtils.getSingleValueString(attrs); |
| | | } |
| | |
| | | HashSet<AttributeType> attributes = new HashSet<>(); |
| | | for (String attrName : attributeStrings) |
| | | { |
| | | attributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | attributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | return attributes; |
| | | } |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeLdifFile = getAttributeTypeOrDefault(ATTR_IMPORT_LDIF_FILE); |
| | | AttributeType typeTemplateFile = getAttributeTypeOrDefault(ATTR_IMPORT_TEMPLATE_FILE); |
| | | AttributeType typeBackendID = getAttributeTypeOrDefault(ATTR_IMPORT_BACKEND_ID); |
| | | AttributeType typeIncludeBranch = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_BRANCH); |
| | | AttributeType typeExcludeBranch = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_BRANCH); |
| | | AttributeType typeIncludeAttribute = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_ATTRIBUTE); |
| | | AttributeType typeExcludeAttribute = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_ATTRIBUTE); |
| | | AttributeType typeIncludeFilter = getAttributeTypeOrDefault(ATTR_IMPORT_INCLUDE_FILTER); |
| | | AttributeType typeExcludeFilter = getAttributeTypeOrDefault(ATTR_IMPORT_EXCLUDE_FILTER); |
| | | AttributeType typeRejectFile = getAttributeTypeOrDefault(ATTR_IMPORT_REJECT_FILE); |
| | | AttributeType typeSkipFile = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_FILE); |
| | | AttributeType typeOverwrite = getAttributeTypeOrDefault(ATTR_IMPORT_OVERWRITE); |
| | | AttributeType typeSkipSchemaValidation = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION); |
| | | AttributeType typeIsCompressed = getAttributeTypeOrDefault(ATTR_IMPORT_IS_COMPRESSED); |
| | | AttributeType typeIsEncrypted = getAttributeTypeOrDefault(ATTR_IMPORT_IS_ENCRYPTED); |
| | | AttributeType typeClearBackend = getAttributeTypeOrDefault(ATTR_IMPORT_CLEAR_BACKEND); |
| | | AttributeType typeRandomSeed = getAttributeTypeOrDefault(ATTR_IMPORT_RANDOM_SEED); |
| | | AttributeType typeThreadCount = getAttributeTypeOrDefault(ATTR_IMPORT_THREAD_COUNT); |
| | | AttributeType typeTmpDirectory = getAttributeTypeOrDefault(ATTR_IMPORT_TMP_DIRECTORY); |
| | | AttributeType typeDNCheckPhase2 = getAttributeTypeOrDefault(ATTR_IMPORT_SKIP_DN_VALIDATION); |
| | | AttributeType typeLdifFile = getAttributeType(ATTR_IMPORT_LDIF_FILE); |
| | | AttributeType typeTemplateFile = getAttributeType(ATTR_IMPORT_TEMPLATE_FILE); |
| | | AttributeType typeBackendID = getAttributeType(ATTR_IMPORT_BACKEND_ID); |
| | | AttributeType typeIncludeBranch = getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH); |
| | | AttributeType typeExcludeBranch = getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH); |
| | | AttributeType typeIncludeAttribute = getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE); |
| | | AttributeType typeExcludeAttribute = getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE); |
| | | AttributeType typeIncludeFilter = getAttributeType(ATTR_IMPORT_INCLUDE_FILTER); |
| | | AttributeType typeExcludeFilter = getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER); |
| | | AttributeType typeRejectFile = getAttributeType(ATTR_IMPORT_REJECT_FILE); |
| | | AttributeType typeSkipFile = getAttributeType(ATTR_IMPORT_SKIP_FILE); |
| | | AttributeType typeOverwrite = getAttributeType(ATTR_IMPORT_OVERWRITE); |
| | | AttributeType typeSkipSchemaValidation = getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION); |
| | | AttributeType typeIsCompressed = getAttributeType(ATTR_IMPORT_IS_COMPRESSED); |
| | | AttributeType typeIsEncrypted = getAttributeType(ATTR_IMPORT_IS_ENCRYPTED); |
| | | AttributeType typeClearBackend = getAttributeType(ATTR_IMPORT_CLEAR_BACKEND); |
| | | AttributeType typeRandomSeed = getAttributeType(ATTR_IMPORT_RANDOM_SEED); |
| | | AttributeType typeThreadCount = getAttributeType(ATTR_IMPORT_THREAD_COUNT); |
| | | AttributeType typeTmpDirectory = getAttributeType(ATTR_IMPORT_TMP_DIRECTORY); |
| | | AttributeType typeDNCheckPhase2 = getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION); |
| | | |
| | | ArrayList<String> ldifFilestmp = asListOfStrings(taskEntry, typeLdifFile); |
| | | ldifFiles = new ArrayList<>(ldifFilestmp.size()); |
| | |
| | | final HashSet<AttributeType> attrTypes = new HashSet<>(attrNames.size()); |
| | | for (String attrName : attrNames) |
| | | { |
| | | attrTypes.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | attrTypes.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | return attrTypes; |
| | | } |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN); |
| | | AttributeType typeScope = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_TARGET_SCOPE); |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN); |
| | | AttributeType typeScope = getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE); |
| | | |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_DOMAIN_DN); |
| | | AttributeType typeSourceScope = getAttributeTypeOrDefault(ATTR_TASK_INITIALIZE_SOURCE); |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_INITIALIZE_DOMAIN_DN); |
| | | AttributeType typeSourceScope = getAttributeType(ATTR_TASK_INITIALIZE_SOURCE); |
| | | |
| | | List<Attribute> attrList; |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | |
| | | // FIXME -- Do we need any special authorization here? |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN); |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, mb.toMessage()); |
| | | } |
| | | |
| | | AttributeType typeMaxDuration = getAttributeTypeOrDefault(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION); |
| | | AttributeType typeMaxDuration = getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION); |
| | | attrList = taskEntry.getAttribute(typeMaxDuration); |
| | | String maxDurationStringInSec = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | final String val = asString(taskEntry, ATTR_REBUILD_INDEX_CLEARDEGRADEDSTATE); |
| | | isClearDegradedState = Boolean.parseBoolean(val); |
| | | |
| | | AttributeType typeIndex = getAttributeTypeOrDefault(ATTR_REBUILD_INDEX); |
| | | AttributeType typeIndex = getAttributeType(ATTR_REBUILD_INDEX); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeIndex); |
| | | indexes = TaskUtils.getMultiValueString(attrList); |
| | | |
| | |
| | | |
| | | private String asString(Entry taskEntry, String attrName) |
| | | { |
| | | final AttributeType attrType = getAttributeTypeOrDefault(attrName); |
| | | final AttributeType attrType = getAttributeType(attrName); |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | return TaskUtils.getSingleValueString(attrList); |
| | | } |
| | |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_BASE_DN; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_CSN; |
| | | import static org.opends.server.config.ConfigConstants.ATTR_TASK_RESET_CHANGE_NUMBER_TO; |
| | | import static org.opends.server.core.DirectoryServer.getAttributeTypeOrDefault; |
| | | import static org.opends.server.core.DirectoryServer.getAttributeType; |
| | | import static org.opends.messages.TaskMessages.*; |
| | | |
| | | /** |
| | |
| | | |
| | | private List<Attribute> getTaskParameter(Entry taskEntry, String attrTaskResetChangeNumberTo) |
| | | { |
| | | AttributeType taskAttr = getAttributeTypeOrDefault(attrTaskResetChangeNumberTo); |
| | | AttributeType taskAttr = getAttributeType(attrTaskResetChangeNumberTo); |
| | | return taskEntry.getAttribute(taskAttr); |
| | | } |
| | | |
| | |
| | | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeBackupDirectory = getAttributeTypeOrDefault(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typebackupID = getAttributeTypeOrDefault(ATTR_BACKUP_ID); |
| | | AttributeType typeVerifyOnly = getAttributeTypeOrDefault(ATTR_TASK_RESTORE_VERIFY_ONLY); |
| | | AttributeType typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typebackupID = getAttributeType(ATTR_BACKUP_ID); |
| | | AttributeType typeVerifyOnly = getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY); |
| | | |
| | | List<Attribute> attrList; |
| | | |
| | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | // Retrieves the eventual generation-ID |
| | | AttributeType typeNewValue = getAttributeTypeOrDefault(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE); |
| | | AttributeType typeNewValue = getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeNewValue); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | } |
| | | |
| | | // Retrieves the replication domain |
| | | AttributeType typeDomainBase = getAttributeTypeOrDefault(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN); |
| | | AttributeType typeDomainBase = getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN); |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | |
| | | restart = false; |
| | | shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(taskEntry.getName()); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SHUTDOWN_MESSAGE); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | } |
| | | |
| | | |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_RESTART_SERVER); |
| | | attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER); |
| | | attrList = taskEntry.getAttribute(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | |
| | | Set<AttributeType> results = new HashSet<>(); |
| | | for (String attrName : attributeArg.getValues()) |
| | | { |
| | | results.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | results.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | return results; |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | excludeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | excludeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | includeAttributes.add(DirectoryServer.getAttributeTypeOrDefault(attrName)); |
| | | includeAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | } |
| | | } |
| | | } |
| | |
| | | LinkedHashSet<AttributeType> operationalAttributeTypes = new LinkedHashSet<>(); |
| | | for (String attributeName : attributeNames) |
| | | { |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(attributeName); |
| | | AttributeType t = DirectoryServer.getAttributeType(attributeName); |
| | | if (t.isOperational()) |
| | | { |
| | | operationalAttributeTypes.add(t); |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a tag that is used to reference the value of a specified |
| | | * attribute already defined in the entry. |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a tag that is used to base presence of one attribute on |
| | | * the absence of another attribute and/or attribute value. |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | AttributeType t = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(t)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.tools.makeldif; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | |
| | | |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.forgerock.i18n.LocalizableMessage; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.types.InitializationException; |
| | | |
| | | import static org.opends.messages.ToolMessages.*; |
| | | |
| | | import static org.opends.server.util.StaticUtils.*; |
| | | |
| | | |
| | | |
| | | /** |
| | | * This class defines a tag that is used to base presence of one attribute on |
| | | * the presence of another attribute and/or attribute value. |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | AttributeType t = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | AttributeType t = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! branch.hasAttribute(t)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | throw new InitializationException(message); |
| | | } |
| | | |
| | | String lowerName = toLowerCase(arguments[0]); |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerName); |
| | | attributeType = DirectoryServer.getAttributeType(arguments[0]); |
| | | if (! template.hasAttribute(attributeType)) |
| | | { |
| | | LocalizableMessage message = |
| | |
| | | StringTokenizer tokenizer = new StringTokenizer(rdnAttrNames, "+"); |
| | | while (tokenizer.hasMoreTokens()) |
| | | { |
| | | attrList.add(DirectoryServer.getAttributeTypeOrDefault(tokenizer.nextToken())); |
| | | attrList.add(DirectoryServer.getAttributeType(tokenizer.nextToken())); |
| | | } |
| | | |
| | | rdnAttributes = new AttributeType[attrList.size()]; |
| | |
| | | } |
| | | } |
| | | |
| | | AttributeType attributeType = DirectoryServer.getAttributeTypeOrDefault(lowerLine.substring(0, colonPos)); |
| | | AttributeType attributeType = DirectoryServer.getAttributeType(lowerLine.substring(0, colonPos)); |
| | | |
| | | // First, check whether the value is an URL value: <attrName>:< <url> |
| | | int length = line.length(); |
| | |
| | | return builder.toAttribute(); |
| | | } |
| | | |
| | | private static AttributeType getAttributeTypeOrDefault(String attributeName) |
| | | { |
| | | return DirectoryServer.getAttributeTypeOrDefault(attributeName); |
| | | } |
| | | |
| | | /** The attribute type for this attribute. */ |
| | | private AttributeType attributeType; |
| | | /** The name of this attribute as provided by the end user. */ |
| | |
| | | */ |
| | | public AttributeBuilder(String attributeName) |
| | | { |
| | | this(getAttributeTypeOrDefault(attributeName), attributeName); |
| | | this(DirectoryServer.getAttributeType(attributeName), attributeName); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public void setAttributeType(String attributeName) |
| | | { |
| | | setAttributeType(getAttributeTypeOrDefault(attributeName), attributeName); |
| | | setAttributeType(DirectoryServer.getAttributeType(attributeName), attributeName); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static Attribute create(String attributeName, String valueString) |
| | | { |
| | | return create(getAttributeTypeOrDefault(attributeName), attributeName, valueString); |
| | | return create(getAttributeType(attributeName), attributeName, valueString); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static Attribute empty(String attributeName) |
| | | { |
| | | return empty(getAttributeTypeOrDefault(attributeName), attributeName); |
| | | return empty(getAttributeType(attributeName), attributeName); |
| | | } |
| | | |
| | | |
| | |
| | | private static RDN newRDN(ByteString attrName, ByteString value) |
| | | { |
| | | String name = attrName.toString(); |
| | | AttributeType attrType = getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = getAttributeType(name); |
| | | return new RDN(attrType, name, value); |
| | | } |
| | | |
| | | private static void addValue(ByteString attributeName, RDN rdn, ByteString empty) |
| | | { |
| | | String name = attributeName.toString(); |
| | | AttributeType attrType = getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = getAttributeType(name); |
| | | rdn.addValue(attrType, name, empty); |
| | | } |
| | | |
| | |
| | | private static RDN newRDN(StringBuilder attributeName, ByteString value) |
| | | { |
| | | String name = attributeName.toString(); |
| | | AttributeType attrType = getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = getAttributeType(name); |
| | | return new RDN(attrType, name, value); |
| | | } |
| | | |
| | | private static void addValue(StringBuilder attributeName, RDN rdn, ByteString empty) |
| | | { |
| | | String name = attributeName.toString(); |
| | | AttributeType attrType = getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = getAttributeType(name); |
| | | rdn.addValue(attrType, name, empty); |
| | | } |
| | | |
| | |
| | | // If using default is a problem, it will be caught later either |
| | | // by not finding the target entry or by not allowing the entry |
| | | // to be added. |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(name); |
| | | |
| | | RDN rdn = new RDN(attrType, name, parsedValue.toByteString()); |
| | | |
| | |
| | | if (pos >= length) |
| | | { |
| | | name = attributeName.toString(); |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | attrType = DirectoryServer.getAttributeType(name); |
| | | |
| | | rdn.addValue(attrType, name, ByteString.empty()); |
| | | return rdn; |
| | |
| | | // If using default is a problem, it will be caught later either |
| | | // by not finding the target entry or by not allowing the entry |
| | | // to be added. |
| | | attrType = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | attrType = DirectoryServer.getAttributeType(name); |
| | | |
| | | rdn.addValue(attrType, name, parsedValue.toByteString()); |
| | | |
| | |
| | | if (attributeType == null) |
| | | { |
| | | String typeStr = attrType.substring(0, lowerType.length()); |
| | | attributeType = DirectoryServer.getAttributeTypeOrDefault(typeStr); |
| | | attributeType = DirectoryServer.getAttributeType(typeStr); |
| | | } |
| | | return attributeType; |
| | | } |
| | |
| | | this.subTreeSpec = null; |
| | | String specString = null; |
| | | boolean isValidSpec = true; |
| | | AttributeType specAttrType = DirectoryServer.getAttributeTypeOrDefault(ATTR_SUBTREE_SPEC_LC); |
| | | AttributeType specAttrType = DirectoryServer.getAttributeType(ATTR_SUBTREE_SPEC_LC); |
| | | for (Attribute attr : entry.getAttribute(specAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromDNType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase()); |
| | | this.inheritFromDNType = DirectoryServer.getAttributeType(value.toString()); |
| | | this.inheritFromDNAttrValue = value; |
| | | break; |
| | | } |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromRDNAttrType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase()); |
| | | this.inheritFromRDNAttrType = DirectoryServer.getAttributeType(value.toString()); |
| | | this.inheritFromRDNAttrValue = value; |
| | | break; |
| | | } |
| | |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | | this.inheritFromRDNType = DirectoryServer.getAttributeTypeOrDefault(value.toString().toLowerCase()); |
| | | this.inheritFromRDNType = DirectoryServer.getAttributeType(value.toString()); |
| | | break; |
| | | } |
| | | } |
| | |
| | | } |
| | | else |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attrName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attrName); |
| | | if (! importConfig.includeAttribute(attrType)) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | |
| | | // Check to see if the entry includes a privilege specification. If so, |
| | | // then the requester must have the PRIVILEGE_CHANGE privilege. |
| | | AttributeType privType = DirectoryServer.getAttributeTypeOrDefault(OP_ATTR_PRIVILEGE_NAME); |
| | | AttributeType privType = DirectoryServer.getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | if (entry.hasAttribute(privType) |
| | | && !clientConnection.hasPrivilege(Privilege.PRIVILEGE_CHANGE, this)) |
| | | { |
| | |
| | | Arg1<Object> nonUniqueAttributeMessage, |
| | | Arg2<Object, Object> cannotProcessAttributeMessage) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attributeTypeName); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attributeTypeName); |
| | | List<Attribute> attrList = userEntry.getAttribute(attrType); |
| | | if (attrList.size() == 1) |
| | | { |
| | |
| | | processModification(m); |
| | | } |
| | | else if (!isInternalOrSynchro(m) |
| | | && t.equals(getAttributeTypeOrDefault(OP_ATTR_ACCOUNT_DISABLED))) |
| | | && t.equals(getAttributeType(OP_ATTR_ACCOUNT_DISABLED))) |
| | | { |
| | | enabledStateChanged = true; |
| | | isEnabled = !pwPolicyState.isDisabled(); |
| | |
| | | { |
| | | EnumTargetOperator op = EnumTargetOperator.createOperator(eqOperator); |
| | | TargetAttr targetAttr = TargetAttr.decode(op, targetAttrString); |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(attribute); |
| | | AttributeType attrType = DirectoryServer.getAttributeType(attribute); |
| | | assertEquals(TargetAttr.isApplicable(attrType, targetAttr), expectedResult); |
| | | } |
| | | } |
| | |
| | | Entry schemaEntry = DirectoryServer.getEntry(DN.valueOf("cn=schema")); |
| | | assertNotNull(schemaEntry); |
| | | |
| | | AttributeType cnType = DirectoryServer.getAttributeTypeOrDefault("creatorsname"); |
| | | AttributeType ctType = DirectoryServer.getAttributeTypeOrDefault("createtimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeTypeOrDefault("modifiersname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeTypeOrDefault("modifytimestamp"); |
| | | AttributeType cnType = DirectoryServer.getAttributeType("creatorsname"); |
| | | AttributeType ctType = DirectoryServer.getAttributeType("createtimestamp"); |
| | | AttributeType mnType = DirectoryServer.getAttributeType("modifiersname"); |
| | | AttributeType mtType = DirectoryServer.getAttributeType("modifytimestamp"); |
| | | |
| | | assertTrue(schemaEntry.hasAttribute(cnType)); |
| | | assertTrue(schemaEntry.hasAttribute(ctType)); |
| | |
| | | Entry actual = new Entry(dbEntry.getName(), dbEntry.getObjectClasses(), dbEntry.getUserAttributes(), null); |
| | | |
| | | // Remove the userPassword because it will have been encoded. |
| | | expected.removeAttribute(DirectoryServer.getAttributeTypeOrDefault("userpassword")); |
| | | actual.removeAttribute(DirectoryServer.getAttributeTypeOrDefault("userpassword")); |
| | | expected.removeAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | actual.removeAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | |
| | | assertThat(actual).isEqualTo(expected); |
| | | } |
| | |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault("description"); |
| | | AttributeType attrType = DirectoryServer.getAttributeType("description"); |
| | | UpdatePreOpPlugin.addAttributeToRemove(attrType); |
| | | |
| | | AddOperation addOperation = getRootConnection().processAdd(entry); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2011 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.core; |
| | | |
| | |
| | | public void testGetAndAddModifications() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isEmpty(); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | UpdatePreOpPlugin.addModification( |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isNotEmpty(); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | public void testSuccessAddAttribute() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isEmpty(); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isEmpty(); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("o=test", replace(attr)); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("description"))).isNotEmpty(); |
| | | assertThat(e.getAttribute(DirectoryServer.getAttributeType("description"))).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o")); |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("o", "test2"); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o")); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o")); |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | LDAPAttribute attr = newLDAPAttribute("o;lang-en-us", "test"); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("o")); |
| | | attrList = e.getAttribute(DirectoryServer.getAttributeType("o")); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber")); |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | assertIntegerValueExists(attrList, 2); |
| | | } |
| | | |
| | |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber")); |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | assertIntegerValueExists(attrList, 11); |
| | | } |
| | | |
| | |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("employeenumber")); |
| | | e.getAttribute(DirectoryServer.getAttributeType("employeenumber")); |
| | | assertIntegerValueExists(attrList, 0); |
| | | } |
| | | |
| | |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | assertTrue(DirectoryServer.entryExists(DN.valueOf("o=test"))); |
| | | assertFalse(DirectoryServer.getEntry(DN.valueOf("o=test")).hasAttribute( |
| | | DirectoryServer.getAttributeTypeOrDefault("description"))); |
| | | DirectoryServer.getAttributeType("description"))); |
| | | } |
| | | |
| | | |
| | |
| | | "userPassword: password"); |
| | | |
| | | List<Attribute> attrList = |
| | | e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("userpassword")); |
| | | e.getAttribute(DirectoryServer.getAttributeType("userpassword")); |
| | | |
| | | String passwd = null; |
| | | for (Attribute a : attrList) |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeTypeOrDefault("usercertificate")); |
| | | List<Attribute> attrList = e.getAttribute(DirectoryServer.getAttributeType("usercertificate")); |
| | | assertThat(attrList).hasSize(1); |
| | | Attribute a = attrList.get(0); |
| | | assertTrue(a.hasOption("binary")); |
| | |
| | | /** |
| | | * Test LDAP authentication mappingPolicy implementation. |
| | | */ |
| | | @SuppressWarnings("javadoc") |
| | | public class LDAPPassThroughAuthenticationPolicyTestCase extends |
| | | ExtensionsTestCase |
| | | { |
| | |
| | | |
| | | |
| | | |
| | | MockPolicyCfg withMappedAttribute(final String atype) |
| | | MockPolicyCfg withMappedAttribute(final String attrName) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getAttributeTypeOrDefault(toLowerCase(atype)); |
| | | mappedAttributes.add(attrType); |
| | | mappedAttributes.add(DirectoryServer.getAttributeType(attrName)); |
| | | return this; |
| | | } |
| | | |
| | |
| | | import org.testng.annotations.Test; |
| | | |
| | | import static org.forgerock.opendj.ldap.ModificationType.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.protocols.internal.Requests.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | |
| | | deleteAttrsEntry(DN dn, String... attrTypeStrings) throws Exception { |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | for(String attrTypeString : attrTypeStrings) { |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | AttributeType attrType = getAttributeType(attrTypeString); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.empty(attrType))); |
| | | } |
| | | getRootConnection().processModify(dn, mods); |
| | | } |
| | | |
| | | private AttributeType getAttrType(String attrTypeString) { |
| | | return DirectoryServer.getAttributeTypeOrDefault(attrTypeString); |
| | | } |
| | | |
| | | private void deleteEntries(String... dns) throws Exception{ |
| | | InternalClientConnection conn = getRootConnection(); |
| | | for(String dn : dns) { |
| | |
| | | String attr, |
| | | String... dns) |
| | | throws Exception { |
| | | AttributeType type= getAttrType(attr); |
| | | AttributeType type= getAttributeType(attr); |
| | | final SearchRequest request = newSearchRequest(entryDN, SearchScope.BASE_OBJECT, "(" + attr + "=*)"); |
| | | InternalSearchOperation operation = getRootConnection().processSearch(request); |
| | | for (SearchResultEntry entry : operation.getSearchEntries()) { |
| | |
| | | import org.opends.server.admin.std.server.UniqueAttributePluginCfg; |
| | | import org.opends.server.api.plugin.PluginType; |
| | | import org.opends.server.core.AddOperation; |
| | | import org.opends.server.core.DirectoryServer; |
| | | import org.opends.server.core.ModifyDNOperation; |
| | | import org.opends.server.core.ModifyOperation; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | import org.opends.server.types.*; |
| | | import org.testng.annotations.*; |
| | | |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.protocols.internal.InternalClientConnection.*; |
| | | import static org.opends.server.util.CollectionUtils.*; |
| | | import static org.testng.Assert.*; |
| | |
| | | deleteAttrsFromEntry(DN dn, String... attrTypeStrings) throws Exception { |
| | | LinkedList<Modification> mods = new LinkedList<>(); |
| | | for(String attrTypeString : attrTypeStrings) { |
| | | AttributeType attrType = getAttrType(attrTypeString); |
| | | AttributeType attrType = getAttributeType(attrTypeString); |
| | | mods.add(new Modification(ModificationType.DELETE, |
| | | Attributes.empty(attrType))); |
| | | } |
| | |
| | | * @param attrTypeString The attribute type string to remove. |
| | | */ |
| | | private void delAttribute(Entry entry, String attrTypeString) { |
| | | entry.removeAttribute(getAttrType(attrTypeString)); |
| | | entry.removeAttribute(getAttributeType(attrTypeString)); |
| | | } |
| | | |
| | | /** |
| | |
| | | Attributes.create(attrName, attrValues))); |
| | | } |
| | | |
| | | private AttributeType getAttrType(String attrTypeString) { |
| | | return DirectoryServer.getAttributeTypeOrDefault(attrTypeString); |
| | | } |
| | | |
| | | /** |
| | | * Perform modify operation with list of modifications. Expect return code |
| | | * of value rc. |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2014-2015 ForgeRock AS |
| | | * Portions Copyright 2014-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.internal; |
| | | |
| | |
| | | InternalClientConnection conn = getRootConnection(); |
| | | CompareOperation compareOperation = |
| | | conn.processCompare(DN.valueOf("cn=test,o=test"), |
| | | DirectoryServer.getAttributeTypeOrDefault("cn"), |
| | | DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOfUtf8("test")); |
| | | assertEquals(compareOperation.getResultCode(), ResultCode.COMPARE_TRUE); |
| | | } |
| | |
| | | * |
| | | * |
| | | * Copyright 2008-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2015 ForgeRock AS |
| | | * Portions Copyright 2011-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.protocols.jmx; |
| | | |
| | |
| | | // Test a compare operation against the PWReset Target user. |
| | | CompareOperationBasis compareOp = new CompareOperationBasis( |
| | | conn, conn.nextOperationID(), conn.nextMessageID(), controls, |
| | | targetDN, DirectoryServer.getAttributeTypeOrDefault("cn"), |
| | | targetDN, DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOfUtf8("PWReset Target")); |
| | | assertSuccess(hasProxyPrivilege, compareOp); |
| | | |
| | |
| | | // Test a compare operation against the PWReset Target user. |
| | | CompareOperationBasis compareOp = new CompareOperationBasis( |
| | | conn, conn.nextOperationID(), conn.nextMessageID(), controls, |
| | | targetDN, DirectoryServer.getAttributeTypeOrDefault("cn"), |
| | | targetDN, DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOfUtf8("PWReset Target")); |
| | | assertSuccess(hasProxyPrivilege, compareOp); |
| | | |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | //Setup the DN to use in the response tests. |
| | | AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute"); |
| | | AttributeType attribute = DirectoryServer.getAttributeType("testAttribute"); |
| | | ByteString attributeValue = ByteString.valueOfUtf8("testValue"); |
| | | dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) }); |
| | | } |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | //Setup the DN to use in the response tests. |
| | | AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute"); |
| | | AttributeType attribute = DirectoryServer.getAttributeType("testAttribute"); |
| | | ByteString attributeValue = ByteString.valueOfUtf8("testValue"); |
| | | dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) }); |
| | | } |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | //Setup the DN to use in the response tests. |
| | | AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute"); |
| | | AttributeType attribute = DirectoryServer.getAttributeType("testAttribute"); |
| | | ByteString attributeValue = ByteString.valueOfUtf8("testValue"); |
| | | dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) }); |
| | | } |
| | |
| | | "ds-cfg-trust-manager-provider: cn=JKS,cn=Trust Manager Providers,cn=config"); |
| | | LDAPConnectionHandler LDAPConnHandler=getLDAPHandlerInstance(GoodHandlerEntry); |
| | | //Make attrTypes to remove |
| | | AttributeType at0=DirectoryServer.getAttributeTypeOrDefault(ATTR_LISTEN_PORT); |
| | | AttributeType at0=DirectoryServer.getAttributeType(ATTR_LISTEN_PORT); |
| | | // AttributeType at1=DirectoryServer.getAttributeType(ATTR_LISTEN_ADDRESS, true); |
| | | // Attribute rAttr1=new Attribute(at1); |
| | | // GoodHandlerEntry.removeAttribute(rAttr1, null); |
| | | AttributeType at2=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at3=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at4=DirectoryServer.getAttributeTypeOrDefault(ATTR_KEEP_LDAP_STATS); |
| | | AttributeType at5=DirectoryServer.getAttributeTypeOrDefault(ATTR_SEND_REJECTION_NOTICE); |
| | | AttributeType at6=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_TCP_KEEPALIVE); |
| | | AttributeType at7=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_TCP_NODELAY); |
| | | AttributeType at8=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_REUSE_ADDRESS); |
| | | AttributeType at9=DirectoryServer.getAttributeTypeOrDefault(ATTR_USE_SSL); |
| | | AttributeType at10=DirectoryServer.getAttributeTypeOrDefault(ATTR_ALLOW_STARTTLS); |
| | | AttributeType at11=DirectoryServer.getAttributeTypeOrDefault(ATTR_MAX_REQUEST_SIZE); |
| | | AttributeType at12=DirectoryServer.getAttributeTypeOrDefault(ATTR_ACCEPT_BACKLOG); |
| | | AttributeType at2=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at3=DirectoryServer.getAttributeType(ATTR_ALLOW_LDAPV2); |
| | | AttributeType at4=DirectoryServer.getAttributeType(ATTR_KEEP_LDAP_STATS); |
| | | AttributeType at5=DirectoryServer.getAttributeType(ATTR_SEND_REJECTION_NOTICE); |
| | | AttributeType at6=DirectoryServer.getAttributeType(ATTR_USE_TCP_KEEPALIVE); |
| | | AttributeType at7=DirectoryServer.getAttributeType(ATTR_USE_TCP_NODELAY); |
| | | AttributeType at8=DirectoryServer.getAttributeType(ATTR_ALLOW_REUSE_ADDRESS); |
| | | AttributeType at9=DirectoryServer.getAttributeType(ATTR_USE_SSL); |
| | | AttributeType at10=DirectoryServer.getAttributeType(ATTR_ALLOW_STARTTLS); |
| | | AttributeType at11=DirectoryServer.getAttributeType(ATTR_MAX_REQUEST_SIZE); |
| | | AttributeType at12=DirectoryServer.getAttributeType(ATTR_ACCEPT_BACKLOG); |
| | | //Remove them |
| | | Attribute rAttr0=Attributes.empty(at0); |
| | | GoodHandlerEntry.removeAttribute(rAttr0, null); |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | //Setup the DN to use in the response tests. |
| | | AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute"); |
| | | AttributeType attribute = DirectoryServer.getAttributeType("testAttribute"); |
| | | ByteString attributeValue = ByteString.valueOfUtf8("testValue"); |
| | | dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) }); |
| | | } |
| | |
| | | TestCaseUtils.startServer(); |
| | | |
| | | //Setup the DN to use in the response tests. |
| | | AttributeType attribute = DirectoryServer.getAttributeTypeOrDefault("testAttribute"); |
| | | AttributeType attribute = DirectoryServer.getAttributeType("testAttribute"); |
| | | ByteString attributeValue = ByteString.valueOfUtf8("testValue"); |
| | | dn = new DN(new RDN[] { RDN.create(attribute, attributeValue) }); |
| | | } |
| | |
| | | @Test |
| | | public void defaultAttributeTypesWithDifferentCaseEquals() |
| | | { |
| | | AttributeType attrType = getAttributeTypeOrDefault("displayName"); |
| | | AttributeType attrType2 = getAttributeTypeOrDefault("displayname"); |
| | | AttributeType attrType = getAttributeType("displayName"); |
| | | AttributeType attrType2 = getAttributeType("displayname"); |
| | | Assert.assertNotSame(attrType, attrType2); |
| | | Assert.assertEquals(attrType, attrType2); |
| | | } |
| | |
| | | CompareOperation compareOperation = new CompareOperationBasis(conn, |
| | | nextOperationID(), nextMessageID(), |
| | | controls, targetDN, |
| | | DirectoryServer.getAttributeTypeOrDefault("cn"), |
| | | DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOfUtf8("PWReset Target")); |
| | | compareOperation.run(); |
| | | if (hasProxyPrivilege) |
| | |
| | | // Test a compare operation against the PWReset Target user. |
| | | CompareOperation compareOperation = new CompareOperationBasis(conn, nextOperationID(), |
| | | nextMessageID(), controls, targetDN, |
| | | DirectoryServer.getAttributeTypeOrDefault("cn"), |
| | | DirectoryServer.getAttributeType("cn"), |
| | | ByteString.valueOfUtf8("PWReset Target")); |
| | | compareOperation.run(); |
| | | if (hasProxyPrivilege) |
| | |
| | | types = new AttributeType[10]; |
| | | |
| | | for (int i = 0; i < types.length; i++) { |
| | | String name = "testType" + i; |
| | | types[i] = DirectoryServer.getAttributeTypeOrDefault(name); |
| | | types[i] = DirectoryServer.getAttributeType("testType" + i); |
| | | } |
| | | } |
| | | |