public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { if (properties == null) { throw new ArgumentNullException("properties"); } using (IEnumerator enumerator = properties.GetEnumerator()) { while (enumerator.MoveNext()) { if (((ActiveDirectorySchemaProperty) enumerator.Current) == null) { throw new ArgumentException("properties"); } } } int count = properties.Count; for (int i = 0; i < count; i++) { this.Add(properties[i]); } }
public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { if (properties == null) { throw new ArgumentNullException("properties"); } foreach (ActiveDirectorySchemaProperty property in properties) { if (property == null) { throw new ArgumentException("properties"); } } int currentCount = properties.Count; for (int i = 0; i < currentCount; i++) { this.Add(properties[i]); } }
public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { if (properties == null) { throw new ArgumentNullException("properties"); } using (IEnumerator enumerator = properties.GetEnumerator()) { while (enumerator.MoveNext()) { if (((ActiveDirectorySchemaProperty)enumerator.Current) == null) { throw new ArgumentException("properties"); } } } int count = properties.Count; for (int i = 0; i < count; i++) { this.Add(properties[i]); } }
public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { if (properties != null) { foreach (ActiveDirectorySchemaProperty property in properties) { if (property != null) { continue; } throw new ArgumentException("properties"); } int count = properties.Count; for (int i = 0; i < count; i++) { this.Add(properties[i]); } return; } else { throw new ArgumentNullException("properties"); } }
public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { throw new NotImplementedException(); }
public void Save() { CheckIfDisposed(); if (!isBound) { try { // create a new directory entry for this class if (_schemaEntry == null) { _schemaEntry = DirectoryEntryManager.GetDirectoryEntry(_context, WellKnownDN.SchemaNamingContext); } // this will create the class and set the CN value string rdn = "CN=" + _commonName; rdn = Utils.GetEscapedPath(rdn); _classEntry = _schemaEntry.Children.Add(rdn, "classSchema"); } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(_context, e); } catch (ActiveDirectoryObjectNotFoundException) { // this is the case where the context is a config set and we could not find an ADAM instance in that config set throw new ActiveDirectoryOperationException(Res.GetString(Res.ADAMInstanceNotFoundInConfigSet, _context.Name)); } // set the ldap display name property SetProperty(PropertyManager.LdapDisplayName, _ldapDisplayName); // set the oid value SetProperty(PropertyManager.GovernsID, _oid); // set the description SetProperty(PropertyManager.Description, _description); // set the possibleSuperiors property if (_possibleSuperiors != null) { _classEntry.Properties[PropertyManager.PossibleSuperiors].AddRange(_possibleSuperiors.GetMultiValuedProperty()); } // set the mandatoryProperties property if (_mandatoryProperties != null) { _classEntry.Properties[PropertyManager.MustContain].AddRange(_mandatoryProperties.GetMultiValuedProperty()); } // set the optionalProperties property if (_optionalProperties != null) { _classEntry.Properties[PropertyManager.MayContain].AddRange(_optionalProperties.GetMultiValuedProperty()); } // set the subClassOf property if (_subClassOf != null) { SetProperty(PropertyManager.SubClassOf, _subClassOf.Name); } else { // if no super class is specified, set it to "top" SetProperty(PropertyManager.SubClassOf, "top"); } // set the objectClassCategory property SetProperty(PropertyManager.ObjectClassCategory, _type); // set the schemaIDGuid property if (_schemaGuidBinaryForm != null) { SetProperty(PropertyManager.SchemaIDGuid, _schemaGuidBinaryForm); } // set the default security descriptor if (_defaultSDSddlForm != null) { SetProperty(PropertyManager.DefaultSecurityDescriptor, _defaultSDSddlForm); } } try { // commit the classEntry to server _classEntry.CommitChanges(); // Refresh the schema cache on the schema role owner if (_schema == null) { ActiveDirectorySchema schemaObject = ActiveDirectorySchema.GetSchema(_context); bool alreadyUsingSchemaRoleOwnerContext = false; DirectoryServer schemaRoleOwner = null; try { // // if we are not already talking to the schema role owner, change the context // schemaRoleOwner = schemaObject.SchemaRoleOwner; if (Utils.Compare(schemaRoleOwner.Name, _context.GetServerName()) != 0) { DirectoryContext schemaRoleOwnerContext = Utils.GetNewDirectoryContext(schemaRoleOwner.Name, DirectoryContextType.DirectoryServer, _context); _schema = ActiveDirectorySchema.GetSchema(schemaRoleOwnerContext); } else { alreadyUsingSchemaRoleOwnerContext = true; _schema = schemaObject; } } finally { if (schemaRoleOwner != null) { schemaRoleOwner.Dispose(); } if (!alreadyUsingSchemaRoleOwnerContext) { schemaObject.Dispose(); } } } _schema.RefreshSchema(); } catch (COMException e) { throw ExceptionHelper.GetExceptionFromCOMException(_context, e); } // now that the changes are committed to the server // update the defunct/non-defunct status of the class on the server _isDefunctOnServer = _isDefunct; // invalidate all properties _commonName = null; _oid = null; _description = null; _descriptionInitialized = false; _possibleSuperiors = null; _auxiliaryClasses = null; _possibleInferiors = null; _mandatoryProperties = null; _optionalProperties = null; _subClassOf = null; _typeInitialized = false; _schemaGuidBinaryForm = null; _defaultSDSddlForm = null; _defaultSDSddlFormInitialized = false; _propertiesFromSchemaContainerInitialized = false; // set bind flag isBound = true; }
public void AddRange (ActiveDirectorySchemaPropertyCollection properties) { throw new NotImplementedException (); }
public void Save() { this.CheckIfDisposed(); if (!this.isBound) { try { if (this.schemaEntry == null) { this.schemaEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, WellKnownDN.SchemaNamingContext); } string escapedPath = Utils.GetEscapedPath("CN=" + this.commonName); this.classEntry = this.schemaEntry.Children.Add(escapedPath, "classSchema"); } catch (COMException exception) { throw ExceptionHelper.GetExceptionFromCOMException(this.context, exception); } catch (ActiveDirectoryObjectNotFoundException) { throw new ActiveDirectoryOperationException(Res.GetString("ADAMInstanceNotFoundInConfigSet", new object[] { this.context.Name })); } this.SetProperty(PropertyManager.LdapDisplayName, this.ldapDisplayName); this.SetProperty(PropertyManager.GovernsID, this.oid); this.SetProperty(PropertyManager.Description, this.description); if (this.possibleSuperiors != null) { this.classEntry.Properties[PropertyManager.PossibleSuperiors].AddRange(this.possibleSuperiors.GetMultiValuedProperty()); } if (this.mandatoryProperties != null) { this.classEntry.Properties[PropertyManager.MustContain].AddRange(this.mandatoryProperties.GetMultiValuedProperty()); } if (this.optionalProperties != null) { this.classEntry.Properties[PropertyManager.MayContain].AddRange(this.optionalProperties.GetMultiValuedProperty()); } if (this.subClassOf != null) { this.SetProperty(PropertyManager.SubClassOf, this.subClassOf.Name); } else { this.SetProperty(PropertyManager.SubClassOf, "top"); } this.SetProperty(PropertyManager.ObjectClassCategory, this.type); if (this.schemaGuidBinaryForm != null) { this.SetProperty(PropertyManager.SchemaIDGuid, this.schemaGuidBinaryForm); } if (this.defaultSDSddlForm != null) { this.SetProperty(PropertyManager.DefaultSecurityDescriptor, this.defaultSDSddlForm); } } try { this.classEntry.CommitChanges(); if (this.schema == null) { ActiveDirectorySchema schema = ActiveDirectorySchema.GetSchema(this.context); bool flag = false; DirectoryServer schemaRoleOwner = null; try { schemaRoleOwner = schema.SchemaRoleOwner; if (Utils.Compare(schemaRoleOwner.Name, this.context.GetServerName()) != 0) { DirectoryContext context = Utils.GetNewDirectoryContext(schemaRoleOwner.Name, DirectoryContextType.DirectoryServer, this.context); this.schema = ActiveDirectorySchema.GetSchema(context); } else { flag = true; this.schema = schema; } } finally { if (schemaRoleOwner != null) { schemaRoleOwner.Dispose(); } if (!flag) { schema.Dispose(); } } } this.schema.RefreshSchema(); } catch (COMException exception2) { throw ExceptionHelper.GetExceptionFromCOMException(this.context, exception2); } this.isDefunctOnServer = this.isDefunct; this.commonName = null; this.oid = null; this.description = null; this.descriptionInitialized = false; this.possibleSuperiors = null; this.auxiliaryClasses = null; this.possibleInferiors = null; this.mandatoryProperties = null; this.optionalProperties = null; this.subClassOf = null; this.typeInitialized = false; this.schemaGuidBinaryForm = null; this.defaultSDSddlForm = null; this.defaultSDSddlFormInitialized = false; this.propertiesFromSchemaContainerInitialized = false; this.isBound = true; }
public void AddRange(ActiveDirectorySchemaPropertyCollection properties) { Contract.Requires(properties != null); }