public int IndexOf(AdamRole role)
        {
            Contract.Ensures(Contract.Result <int>() >= 0);
            Contract.Ensures(Contract.Result <int>() < this.Count);

            return(default(int));
        }
    public int IndexOf(AdamRole role)
    {
      Contract.Ensures(Contract.Result<int>() >= 0);
      Contract.Ensures(Contract.Result<int>() < this.Count);

      return default(int);
    }
        private AdamInstance GetRoleOwner(AdamRole role)
        {
            DirectoryEntry directoryEntry   = null;
            string         adamInstanceName = null;

            try
            {
                switch (role)
                {
                case AdamRole.SchemaRole:
                    directoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
                    break;

                case AdamRole.NamingRole:
                    directoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
                    break;
                }
                directoryEntry.RefreshCache();
                adamInstanceName = Utils.GetAdamDnsHostNameFromNTDSA(this.context, (string)PropertyManager.GetPropertyValue(this.context, directoryEntry, PropertyManager.FsmoRoleOwner));
            }
            catch (COMException exception)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(this.context, exception);
            }
            finally
            {
                if (directoryEntry != null)
                {
                    directoryEntry.Dispose();
                }
            }
            return(new AdamInstance(Utils.GetNewDirectoryContext(adamInstanceName, DirectoryContextType.DirectoryServer, this.context), adamInstanceName));
        }
        public void SeizeRoleOwnership(AdamRole role)
        {
            // set the "fsmoRoleOwner" attribute on the appropriate role object
            // to the NTDSAObjectName of this ADAM Instance
            string roleObjectDN = null;

            CheckIfDisposed();

            switch (role)
            {
            case AdamRole.SchemaRole:
            {
                roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
                break;
            }

            case AdamRole.NamingRole:
            {
                roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
                break;
            }

            default:
            {
                throw new InvalidEnumArgumentException(nameof(role), (int)role, typeof(AdamRole));
            }
            }

            DirectoryEntry roleObjectEntry = null;

            try
            {
                roleObjectEntry = DirectoryEntryManager.GetDirectoryEntry(context, roleObjectDN);
                roleObjectEntry.Properties[PropertyManager.FsmoRoleOwner].Value = NtdsaObjectName;
                roleObjectEntry.CommitChanges();
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            finally
            {
                if (roleObjectEntry != null)
                {
                    roleObjectEntry.Dispose();
                }
            }

            // invalidate the role collection so that it gets loaded again next time
            _cachedRoles = null;
        }
Example #5
0
        /// <returns>Returns a DomainController object for the DC that holds the specified FSMO role</returns>
        private AdamInstance GetRoleOwner(AdamRole role)
        {
            DirectoryEntry entry = null;

            string adamInstName = null;

            try
            {
                switch (role)
                {
                case AdamRole.SchemaRole:
                {
                    entry = _directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
                    break;
                }

                case AdamRole.NamingRole:
                {
                    entry = _directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
                    break;
                }

                default:
                    // should not happen since we are calling this only internally
                    Debug.Fail("ConfigurationSet.GetRoleOwner: Invalid role type.");
                    break;
                }
                entry.RefreshCache();
                adamInstName = Utils.GetAdamDnsHostNameFromNTDSA(_context, (string)PropertyManager.GetPropertyValue(_context, entry, PropertyManager.FsmoRoleOwner));
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(_context, e);
            }
            finally
            {
                if (entry != null)
                {
                    entry.Dispose();
                }
            }

            // create a new context object for the adam instance passing on  the
            // credentials from the context
            DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName, DirectoryContextType.DirectoryServer, _context);

            return(new AdamInstance(adamInstContext, adamInstName));
        }
 public int IndexOf(AdamRole role)
 {
     if ((role < AdamRole.SchemaRole) || (role > AdamRole.NamingRole))
     {
         throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
     }
     for (int i = 0; i < base.InnerList.Count; i++)
     {
         int num2 = (int)base.InnerList[i];
         if (num2 == role)
         {
             return(i);
         }
     }
     return(-1);
 }
 public int IndexOf(AdamRole role)
 {
     if ((role < AdamRole.SchemaRole) || (role > AdamRole.NamingRole))
     {
         throw new InvalidEnumArgumentException("role", (int) role, typeof(AdamRole));
     }
     for (int i = 0; i < base.InnerList.Count; i++)
     {
         int num2 = (int) base.InnerList[i];
         if (num2 == role)
         {
             return i;
         }
     }
     return -1;
 }
Example #8
0
        public bool Contains(AdamRole role)
        {
            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }

            for (int i = 0; i < InnerList.Count; i++)
            {
                int tmp = (int)InnerList[i];
                if (tmp == (int)role)
                {
                    return(true);
                }
            }
            return(false);
        }
 public void TransferRoleOwnership(AdamRole role)
 {
     base.CheckIfDisposed();
     if ((role < AdamRole.SchemaRole) || (role > AdamRole.NamingRole))
     {
         throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
     }
     try
     {
         DirectoryEntry cachedDirectoryEntry = base.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
         cachedDirectoryEntry.Properties[this.becomeRoleOwnerAttrs[(int)role]].Value = 1;
         cachedDirectoryEntry.CommitChanges();
     }
     catch (COMException exception)
     {
         throw System.DirectoryServices.ActiveDirectory.ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
     }
     this.cachedRoles = null;
 }
Example #10
0
        public int IndexOf(AdamRole role)
        {
            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }

            for (int i = 0; i < InnerList.Count; i++)
            {
                int tmp = (int)InnerList[i];

                if (tmp == (int)role)
                {
                    return(i);
                }
            }

            return(-1);
        }
        public void SeizeRoleOwnership(AdamRole role)
        {
            string dn = null;

            base.CheckIfDisposed();
            switch (role)
            {
            case AdamRole.SchemaRole:
                dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
                break;

            case AdamRole.NamingRole:
                dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
                break;

            default:
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }
            DirectoryEntry directoryEntry = null;

            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(base.context, dn);
                directoryEntry.Properties[PropertyManager.FsmoRoleOwner].Value = this.NtdsaObjectName;
                directoryEntry.CommitChanges();
            }
            catch (COMException exception)
            {
                throw System.DirectoryServices.ActiveDirectory.ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
            }
            finally
            {
                if (directoryEntry != null)
                {
                    directoryEntry.Dispose();
                }
            }
            this.cachedRoles = null;
        }
Example #12
0
        private AdamInstance GetRoleOwner(AdamRole role)
        {
            DirectoryEntry cachedDirectoryEntry     = null;
            string         adamDnsHostNameFromNTDSA = null;

            using (cachedDirectoryEntry)
            {
                try
                {
                    AdamRole adamRole = role;
                    switch (adamRole)
                    {
                    case AdamRole.SchemaRole:
                    {
                        cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
                        break;
                    }

                    case AdamRole.NamingRole:
                    {
                        cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
                        break;
                    }
                    }
                    cachedDirectoryEntry.RefreshCache();
                    adamDnsHostNameFromNTDSA = Utils.GetAdamDnsHostNameFromNTDSA(this.context, (string)PropertyManager.GetPropertyValue(this.context, cachedDirectoryEntry, PropertyManager.FsmoRoleOwner));
                }
                catch (COMException cOMException1)
                {
                    COMException cOMException = cOMException1;
                    throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
                }
            }
            DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(adamDnsHostNameFromNTDSA, DirectoryContextType.DirectoryServer, this.context);

            return(new AdamInstance(newDirectoryContext, adamDnsHostNameFromNTDSA));
        }
Example #13
0
        public void SeizeRoleOwnership(AdamRole role)
        {
            string str = null;

            base.CheckIfDisposed();
            AdamRole adamRole = role;

            if (adamRole == AdamRole.SchemaRole)
            {
                str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
            }
            else if (adamRole == AdamRole.NamingRole)
            {
                str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
            }
            else
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }
            DirectoryEntry directoryEntry = null;

            using (directoryEntry)
            {
                try
                {
                    directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, str);
                    directoryEntry.Properties[PropertyManager.FsmoRoleOwner].Value = this.NtdsaObjectName;
                    directoryEntry.CommitChanges();
                }
                catch (COMException cOMException1)
                {
                    COMException cOMException = cOMException1;
                    throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
                }
            }
            this.cachedRoles = null;
        }
        public void TransferRoleOwnership(AdamRole role)
        {
            CheckIfDisposed();

            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException(nameof(role), (int)role, typeof(AdamRole));
            }

            // set the appropriate attribute on the root dse
            try
            {
                DirectoryEntry rootDSE = directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
                rootDSE.Properties[_becomeRoleOwnerAttrs[(int)role]].Value = 1;
                rootDSE.CommitChanges();
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }

            // invalidate the role collection so that it gets loaded again next time
            _cachedRoles = null;
        }
Example #15
0
 public void TransferRoleOwnership(AdamRole role)
 {
     base.CheckIfDisposed();
     if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
     {
         throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
     }
     else
     {
         try
         {
             DirectoryEntry cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
             cachedDirectoryEntry.Properties[this.becomeRoleOwnerAttrs[(int)role]].Value = 1;
             cachedDirectoryEntry.CommitChanges();
         }
         catch (COMException cOMException1)
         {
             COMException cOMException = cOMException1;
             throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
         }
         this.cachedRoles = null;
         return;
     }
 }
Example #16
0
		public int IndexOf(AdamRole role)
		{
			if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
			{
				throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
			}
			else
			{
				int num = 0;
				while (num < base.InnerList.Count)
				{
					int item = (int)base.InnerList[num];
					if ((AdamRole)item != role)
					{
						num++;
					}
					else
					{
						return num;
					}
				}
				return -1;
			}
		}
Example #17
0
 public int IndexOf(AdamRole role)
 {
     if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
     {
         throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
     }
     else
     {
         int num = 0;
         while (num < base.InnerList.Count)
         {
             int item = (int)base.InnerList[num];
             if ((AdamRole)item != role)
             {
                 num++;
             }
             else
             {
                 return(num);
             }
         }
         return(-1);
     }
 }
	public int IndexOf(AdamRole role) {}
	// Methods
	public bool Contains(AdamRole role) {}
Example #20
0
 // Methods
 public bool Contains(AdamRole role)
 {
 }
Example #21
0
		private AdamInstance GetRoleOwner(AdamRole role)
		{
			DirectoryEntry cachedDirectoryEntry = null;
			string adamDnsHostNameFromNTDSA = null;
			using (cachedDirectoryEntry)
			{
				try
				{
					AdamRole adamRole = role;
					switch (adamRole)
					{
						case AdamRole.SchemaRole:
						{
							cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
							break;
						}
						case AdamRole.NamingRole:
						{
							cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
							break;
						}
					}
					cachedDirectoryEntry.RefreshCache();
					adamDnsHostNameFromNTDSA = Utils.GetAdamDnsHostNameFromNTDSA(this.context, (string)PropertyManager.GetPropertyValue(this.context, cachedDirectoryEntry, PropertyManager.FsmoRoleOwner));
				}
				catch (COMException cOMException1)
				{
					COMException cOMException = cOMException1;
					throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
				}
			}
			DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(adamDnsHostNameFromNTDSA, DirectoryContextType.DirectoryServer, this.context);
			return new AdamInstance(newDirectoryContext, adamDnsHostNameFromNTDSA);
		}
 public void CopyTo(AdamRole[] roles, int index)
 {
     base.InnerList.CopyTo(roles, index);
 }
Example #23
0
        public bool Contains(AdamRole role)
        {
            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }

            for (int i = 0; i < InnerList.Count; i++)
            {
                int tmp = (int)InnerList[i];
                if (tmp == (int)role)
                {
                    return true;
                }
            }
            return false;
        }
        private AdamInstance GetRoleOwner(AdamRole role)
        {
            DirectoryEntry directoryEntry = null;
            string adamInstanceName = null;
            try
            {
                switch (role)
                {
                    case AdamRole.SchemaRole:
                        directoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
                        break;

                    case AdamRole.NamingRole:
                        directoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
                        break;
                }
                directoryEntry.RefreshCache();
                adamInstanceName = Utils.GetAdamDnsHostNameFromNTDSA(this.context, (string) PropertyManager.GetPropertyValue(this.context, directoryEntry, PropertyManager.FsmoRoleOwner));
            }
            catch (COMException exception)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(this.context, exception);
            }
            finally
            {
                if (directoryEntry != null)
                {
                    directoryEntry.Dispose();
                }
            }
            return new AdamInstance(Utils.GetNewDirectoryContext(adamInstanceName, DirectoryContextType.DirectoryServer, this.context), adamInstanceName);
        }
 public void SeizeRoleOwnership(AdamRole role)
 {
 }
 public void SeizeRoleOwnership(AdamRole role)
 {
 }
 public bool Contains(AdamRole role)
 {
     return(default(bool));
 }
Example #28
0
        /// <returns>Returns a DomainController object for the DC that holds the the specified FSMO role</returns>
        private AdamInstance GetRoleOwner(AdamRole role)
        {
            DirectoryEntry entry = null;

            string adamInstName = null;
            try
            {
                switch (role)
                {
                    case AdamRole.SchemaRole:
                        {
                            entry = _directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.SchemaNamingContext);
                            break;
                        }

                    case AdamRole.NamingRole:
                        {
                            entry = _directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.PartitionsContainer);
                            break;
                        }

                    default:
                        // should not happen since we are calling this only internally
                        Debug.Assert(false, "ConfigurationSet.GetRoleOwner: Invalid role type.");
                        break;
                }
                entry.RefreshCache();
                adamInstName = Utils.GetAdamDnsHostNameFromNTDSA(_context, (string)PropertyManager.GetPropertyValue(_context, entry, PropertyManager.FsmoRoleOwner));
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(_context, e);
            }
            finally
            {
                if (entry != null)
                {
                    entry.Dispose();
                }
            }

            // create a new context object for the adam instance passing on  the 
            // credentials from the context
            DirectoryContext adamInstContext = Utils.GetNewDirectoryContext(adamInstName, DirectoryContextType.DirectoryServer, _context);

            return new AdamInstance(adamInstContext, adamInstName);
        }
	public void CopyTo(AdamRole[] roles, int index) {}
Example #30
0
		public void SeizeRoleOwnership(AdamRole role)
		{
			string str = null;
			base.CheckIfDisposed();
			AdamRole adamRole = role;
			if (adamRole == AdamRole.SchemaRole)
			{
				str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
			}
			else if (adamRole == AdamRole.NamingRole)
			{
				str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
			}
			else
			{
				throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
			}
			DirectoryEntry directoryEntry = null;
			using (directoryEntry)
			{
				try
				{
					directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, str);
					directoryEntry.Properties[PropertyManager.FsmoRoleOwner].Value = this.NtdsaObjectName;
					directoryEntry.CommitChanges();
				}
				catch (COMException cOMException1)
				{
					COMException cOMException = cOMException1;
					throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
				}
			}
			this.cachedRoles = null;
		}
Example #31
0
        public int IndexOf(AdamRole role)
        {
            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }

            for (int i = 0; i < InnerList.Count; i++)
            {
                int tmp = (int)InnerList[i];

                if (tmp == (int)role)
                {
                    return i;
                }
            }

            return -1;
        }
Example #32
0
		public void TransferRoleOwnership(AdamRole role)
		{
			base.CheckIfDisposed();
			if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
			{
				throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
			}
			else
			{
				try
				{
					DirectoryEntry cachedDirectoryEntry = this.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
					cachedDirectoryEntry.Properties[this.becomeRoleOwnerAttrs[(int)role]].Value = 1;
					cachedDirectoryEntry.CommitChanges();
				}
				catch (COMException cOMException1)
				{
					COMException cOMException = cOMException1;
					throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException);
				}
				this.cachedRoles = null;
				return;
			}
		}
Example #33
0
        public void TransferRoleOwnership(AdamRole role)
        {
            CheckIfDisposed();

            if (role < AdamRole.SchemaRole || role > AdamRole.NamingRole)
            {
                throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
            }

            // set the appropriate attribute on the root dse 
            try
            {
                DirectoryEntry rootDSE = directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
                rootDSE.Properties[_becomeRoleOwnerAttrs[(int)role]].Value = 1;
                rootDSE.CommitChanges();
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }

            // invalidate the role collection so that it gets loaded again next time
            _cachedRoles = null;
        }
 public void TransferRoleOwnership(AdamRole role)
 {
 }
 public bool Contains(AdamRole role)
 {
   return default(bool);
 }
        public void SeizeRoleOwnership(AdamRole role)
        {
            string dn = null;
            base.CheckIfDisposed();
            switch (role)
            {
                case AdamRole.SchemaRole:
                    dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
                    break;

                case AdamRole.NamingRole:
                    dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
                    break;

                default:
                    throw new InvalidEnumArgumentException("role", (int) role, typeof(AdamRole));
            }
            DirectoryEntry directoryEntry = null;
            try
            {
                directoryEntry = DirectoryEntryManager.GetDirectoryEntry(base.context, dn);
                directoryEntry.Properties[PropertyManager.FsmoRoleOwner].Value = this.NtdsaObjectName;
                directoryEntry.CommitChanges();
            }
            catch (COMException exception)
            {
                throw System.DirectoryServices.ActiveDirectory.ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
            }
            finally
            {
                if (directoryEntry != null)
                {
                    directoryEntry.Dispose();
                }
            }
            this.cachedRoles = null;
        }
Example #37
0
        public void SeizeRoleOwnership(AdamRole role)
        {
            // set the "fsmoRoleOwner" attribute on the appropriate role object
            // to the NTDSAObjectName of this ADAM Instance
            string roleObjectDN = null;

            CheckIfDisposed();

            switch (role)
            {
                case AdamRole.SchemaRole:
                    {
                        roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext);
                        break;
                    }
                case AdamRole.NamingRole:
                    {
                        roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer);
                        break;
                    }
                default:
                    {
                        throw new InvalidEnumArgumentException("role", (int)role, typeof(AdamRole));
                    }
            }

            DirectoryEntry roleObjectEntry = null;
            try
            {
                roleObjectEntry = DirectoryEntryManager.GetDirectoryEntry(context, roleObjectDN);
                roleObjectEntry.Properties[PropertyManager.FsmoRoleOwner].Value = NtdsaObjectName;
                roleObjectEntry.CommitChanges();
            }
            catch (COMException e)
            {
                throw ExceptionHelper.GetExceptionFromCOMException(context, e);
            }
            finally
            {
                if (roleObjectEntry != null)
                {
                    roleObjectEntry.Dispose();
                }
            }

            // invalidate the role collection so that it gets loaded again next time
            _cachedRoles = null;
        }
 public void TransferRoleOwnership(AdamRole role)
 {
     base.CheckIfDisposed();
     if ((role < AdamRole.SchemaRole) || (role > AdamRole.NamingRole))
     {
         throw new InvalidEnumArgumentException("role", (int) role, typeof(AdamRole));
     }
     try
     {
         DirectoryEntry cachedDirectoryEntry = base.directoryEntryMgr.GetCachedDirectoryEntry(WellKnownDN.RootDSE);
         cachedDirectoryEntry.Properties[this.becomeRoleOwnerAttrs[(int) role]].Value = 1;
         cachedDirectoryEntry.CommitChanges();
     }
     catch (COMException exception)
     {
         throw System.DirectoryServices.ActiveDirectory.ExceptionHelper.GetExceptionFromCOMException(base.context, exception);
     }
     this.cachedRoles = null;
 }
 public void TransferRoleOwnership(AdamRole role)
 {
 }
Example #40
0
 public int IndexOf(AdamRole role)
 {
 }