Пример #1
0
		public ModifyRequest (string distinguishedName, params DirectoryAttributeModification [] modifications)
			: this ()
		{
			DistinguishedName = distinguishedName;
			Modifications = new DirectoryAttributeModificationCollection ();
			Modifications.AddRange (modifications);
		}
Пример #2
0
 public void AddRange(DirectoryAttributeModificationCollection attributeCollection)
 {
     foreach (var a in attributeCollection)
     {
         List.Add(a);
     }
 }
Пример #3
0
 public ModifyRequest(string distinguishedName, params DirectoryAttributeModification [] modifications)
     : this()
 {
     DistinguishedName = distinguishedName;
     Modifications     = new DirectoryAttributeModificationCollection();
     Modifications.AddRange(modifications);
 }
 public void AddRange(DirectoryAttributeModificationCollection attributeCollection)
 {
     if (attributeCollection == null)
     {
         throw new ArgumentNullException("attributeCollection");
     }
     int count = attributeCollection.Count;
     for (int i = 0; i < count; i++)
     {
         this.Add(attributeCollection[i]);
     }
 }
        public void AddRange(DirectoryAttributeModificationCollection attributeCollection)
        {
            if (attributeCollection == null)
            {
                throw new ArgumentNullException("attributeCollection");
            }
            int count = attributeCollection.Count;

            for (int i = 0; i < count; i++)
            {
                this.Add(attributeCollection[i]);
            }
        }
 public ModifyRequest()
 {
     this.attributeModificationList = new DirectoryAttributeModificationCollection();
 }
		public void AddRange (DirectoryAttributeModificationCollection attributeCollection)
		{
			foreach (var a in attributeCollection)
				List.Add (a);
		}
 public ModifyRequest()
 {
     this.attributeModificationList = new DirectoryAttributeModificationCollection();
 }
Пример #9
0
        /// <summary>
        /// Collect the set of pending modifications for sending to the LDAP DSA
        /// </summary>
        /// <returns></returns>
        internal DirectoryAttributeModificationCollection ChangesAsDAMC()
        {
            DirectoryAttributeModificationCollection damc = new DirectoryAttributeModificationCollection();
            foreach (DirectoryAttributeModification dam in _changes.Values)
                damc.Add(dam);

            return damc;
        }
Пример #10
0
		private void UpdateValueCollectionChanges(string attrName, ADPropertyValueCollection valueCollection, DirectoryAttributeModificationCollection mods)
		{
			DirectoryAttributeModification directoryAttributeModification;
			if (valueCollection != null)
			{
				if (!valueCollection.TrackChanges)
				{
					directoryAttributeModification = this.CreateDirAttrModification(attrName, valueCollection, null);
					mods.Add(directoryAttributeModification);
				}
				else
				{
					if (!valueCollection.IsValuesCleared)
					{
						if (valueCollection.ReplacedValues.Count <= 0)
						{
							if (valueCollection.DeletedValues.Count > 0)
							{
								directoryAttributeModification = this.CreateDirAttrModification(attrName, valueCollection.DeletedValues, null);
								directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
								mods.Add(directoryAttributeModification);
							}
							if (valueCollection.AddedValues.Count > 0)
							{
								directoryAttributeModification = new DirectoryAttributeModification();
								directoryAttributeModification.Operation = DirectoryAttributeOperation.Add;
								this.CreateDirAttrModification(attrName, valueCollection.AddedValues, directoryAttributeModification);
								mods.Add(directoryAttributeModification);
								return;
							}
						}
						else
						{
							directoryAttributeModification = this.CreateDirAttrModification(attrName, valueCollection.ReplacedValues, null);
							mods.Add(directoryAttributeModification);
							return;
						}
					}
					else
					{
						directoryAttributeModification = new DirectoryAttributeModification();
						directoryAttributeModification.Name = attrName;
						directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
						mods.Add(directoryAttributeModification);
						return;
					}
				}
				return;
			}
			else
			{
				directoryAttributeModification = new DirectoryAttributeModification();
				directoryAttributeModification.Name = attrName;
				directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
				mods.Add(directoryAttributeModification);
				return;
			}
		}
Пример #11
0
		public void Update()
		{
			ADPropertyValueCollection value;
			this.Init();
			DebugLogger.WriteLine("ADActiveObject", string.Concat("Update called for ", this._adObject.DistinguishedName));
			DirectoryAttributeModificationCollection directoryAttributeModificationCollection = new DirectoryAttributeModificationCollection();
			if (!this._adObject.TrackChanges)
			{
				bool flag = false;
				foreach (KeyValuePair<string, ADPropertyValueCollection> keyValuePair in this._adObject)
				{
					string key = keyValuePair.Key;
					if (flag || string.Compare(key, "distinguishedName", StringComparison.OrdinalIgnoreCase) != 0)
					{
						value = keyValuePair.Value;
						this.UpdateValueCollectionChanges(key, value, directoryAttributeModificationCollection);
					}
					else
					{
						flag = true;
					}
				}
			}
			else
			{
				foreach (string addedProperty in this._adObject.AddedProperties)
				{
					value = this._adObject[addedProperty];
					this.UpdateValueCollectionChanges(addedProperty, value, directoryAttributeModificationCollection);
				}
				foreach (string removedProperty in this._adObject.RemovedProperties)
				{
					DirectoryAttributeModification directoryAttributeModification = new DirectoryAttributeModification();
					directoryAttributeModification.Name = removedProperty;
					directoryAttributeModification.Operation = DirectoryAttributeOperation.Delete;
					directoryAttributeModificationCollection.Add(directoryAttributeModification);
				}
				foreach (string modifiedProperty in this._adObject.ModifiedProperties)
				{
					value = this._adObject[modifiedProperty];
					this.UpdateValueCollectionChanges(modifiedProperty, value, directoryAttributeModificationCollection);
				}
			}
			if (directoryAttributeModificationCollection.Count != 0)
			{
				DirectoryAttributeModification[] directoryAttributeModificationArray = new DirectoryAttributeModification[directoryAttributeModificationCollection.Count];
				directoryAttributeModificationCollection.CopyTo(directoryAttributeModificationArray, 0);
				ADModifyRequest aDModifyRequest = new ADModifyRequest(this._adObject.DistinguishedName, directoryAttributeModificationArray);
				PermissiveModifyControl permissiveModifyControl = new PermissiveModifyControl();
				aDModifyRequest.Controls.Add(permissiveModifyControl);
				if (this._sdFlags != SecurityMasks.None)
				{
					aDModifyRequest.Controls.Add(new SecurityDescriptorFlagControl(this._sdFlags));
				}
				this._syncOps.Modify(this._sessionHandle, aDModifyRequest);
				DebugLogger.WriteLine("ADActiveObject", string.Concat("Update succeeded for ", this._adObject.DistinguishedName));
				return;
			}
			else
			{
				return;
			}
		}