public bool Contains(ActiveDirectoryRole role) { Contract.Requires(role >= ActiveDirectoryRole.SchemaRole); Contract.Requires(ActiveDirectoryRole.InfrastructureRole <= role); return(default(bool)); }
public int IndexOf(ActiveDirectoryRole role) { Contract.Requires(role >= ActiveDirectoryRole.SchemaRole); Contract.Requires(role <= ActiveDirectoryRole.InfrastructureRole); return(default(int)); }
private void OnSetupRoles(object sender, EventArgs e) { ActiveDirectoryRole poInitiatorsRole = ActiveDirectoryRoleFactory.CreateFromAlias("ADGroup"); // Add the role to the WorkflowRoleCollection representing the POInitiators POInitiators.Add(poInitiatorsRole); }
private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry directoryEntry = null; string domainControllerName = null; try { switch (role) { case ActiveDirectoryRole.SchemaRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext)); break; case ActiveDirectoryRole.NamingRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); break; } domainControllerName = Utils.GetDnsHostNameFromNTDSA(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 DomainController(Utils.GetNewDirectoryContext(domainControllerName, DirectoryContextType.DirectoryServer, this.context), domainControllerName)); }
public bool Contains(ActiveDirectoryRole role) { Contract.Requires(role >= ActiveDirectoryRole.SchemaRole); Contract.Requires(ActiveDirectoryRole.InfrastructureRole <= role); return default(bool); }
public int IndexOf(ActiveDirectoryRole role) { Contract.Requires(role >= ActiveDirectoryRole.SchemaRole); Contract.Requires(role <= ActiveDirectoryRole.InfrastructureRole); return default(int); }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { string dn = null; base.CheckIfDisposed(); switch (role) { case ActiveDirectoryRole.SchemaRole: dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext); break; case ActiveDirectoryRole.NamingRole: dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer); break; case ActiveDirectoryRole.PdcRole: dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext); break; case ActiveDirectoryRole.RidRole: dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager); break; case ActiveDirectoryRole.InfrastructureRole: dn = base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure); break; default: throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } 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; }
public int IndexOf(ActiveDirectoryRole role) { if ((role < ActiveDirectoryRole.SchemaRole) || (role > ActiveDirectoryRole.InfrastructureRole)) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } 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(ActiveDirectoryRole role) { if ((role < ActiveDirectoryRole.SchemaRole) || (role > ActiveDirectoryRole.InfrastructureRole)) { throw new InvalidEnumArgumentException("role", (int) role, typeof(ActiveDirectoryRole)); } for (int i = 0; i < base.InnerList.Count; i++) { int num2 = (int) base.InnerList[i]; if (num2 == role) { return i; } } return -1; }
// // Returns a DomainController object for the DC that holds the specified FSMO role // private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry?entry = null; string? dcName = null; try { switch (role) { case ActiveDirectoryRole.SchemaRole: { entry = DirectoryEntryManager.GetDirectoryEntry(_context, _directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext)); break; } case ActiveDirectoryRole.NamingRole: { entry = DirectoryEntryManager.GetDirectoryEntry(_context, _directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); break; } default: // should not happen since we are calling this only internally Debug.Fail("Forest.GetRoleOwner: Invalid role type."); break; } dcName = Utils.GetDnsHostNameFromNTDSA(_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 domain controller passing on the // credentials from the forest context DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, _context); return(new DomainController(dcContext, dcName)); }
public bool Contains(ActiveDirectoryRole role) { if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } for (int i = 0; i < InnerList.Count; i++) { int tmp = (int)InnerList[i]; if (tmp == (int)role) { return(true); } } return(false); }
public bool Contains(ActiveDirectoryRole role) { if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } for (int i = 0; i < InnerList.Count; i++) { int tmp = (int)InnerList[i]; if (tmp == (int)role) { return true; } } return false; }
public void TransferRoleOwnership(ActiveDirectoryRole role) { base.CheckIfDisposed(); if ((role < ActiveDirectoryRole.SchemaRole) || (role > ActiveDirectoryRole.InfrastructureRole)) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } 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 int IndexOf(ActiveDirectoryRole role) { if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException(nameof(role), (int)role, typeof(ActiveDirectoryRole)); } for (int i = 0; i < InnerList.Count; i++) { int tmp = (int)InnerList[i]; if (tmp == (int)role) { return(i); } } return(-1); }
public int IndexOf(ActiveDirectoryRole role) { if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } else { int num = 0; while (num < base.InnerList.Count) { int item = (int)base.InnerList[num]; if ((ActiveDirectoryRole)item != role) { num++; } else { return num; } } return -1; } }
public int IndexOf(ActiveDirectoryRole role) { if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } else { int num = 0; while (num < base.InnerList.Count) { int item = (int)base.InnerList[num]; if ((ActiveDirectoryRole)item != role) { num++; } else { return(num); } } return(-1); } }
public void CopyTo(ActiveDirectoryRole[] roles, int index) { Contract.Requires(roles != null); Contract.Requires(roles.Rank == 1); Contract.Requires(index >= 0); }
/// <returns>Returns a DomainController object for the DC that holds the the specified FSMO role</returns> private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry entry = null; string dcName = null; try { switch (role) { case ActiveDirectoryRole.PdcRole: { entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); break; } case ActiveDirectoryRole.RidRole: { entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager)); break; } case ActiveDirectoryRole.InfrastructureRole: { entry = DirectoryEntryManager.GetDirectoryEntry(context, directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure)); break; } default: // should not happen since we are calling this only internally Debug.Assert(false, "Domain.GetRoleOwner: Invalid role type."); break; } dcName = Utils.GetDnsHostNameFromNTDSA(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 domain controller passing on the // credentials from the domain context DirectoryContext dcContext = Utils.GetNewDirectoryContext(dcName, DirectoryContextType.DirectoryServer, context); return new DomainController(dcContext, dcName); }
public bool Contains (ActiveDirectoryRole role) { throw new NotImplementedException (); }
public int IndexOf (ActiveDirectoryRole role) { throw new NotImplementedException (); }
public void CopyTo(ActiveDirectoryRole[] roles, int index) { InnerList.CopyTo(roles, index); }
public void TransferRoleOwnership(ActiveDirectoryRole role) { }
// Methods public bool Contains(ActiveDirectoryRole role) { }
public void CopyTo (ActiveDirectoryRole[] roles, int index) { throw new NotImplementedException (); }
private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry directoryEntry = null; string domainControllerName = null; try { switch (role) { case ActiveDirectoryRole.SchemaRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext)); break; case ActiveDirectoryRole.NamingRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); break; } domainControllerName = Utils.GetDnsHostNameFromNTDSA(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 DomainController(Utils.GetNewDirectoryContext(domainControllerName, DirectoryContextType.DirectoryServer, this.context), domainControllerName); }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { string str = null; base.CheckIfDisposed(); ActiveDirectoryRole activeDirectoryRole = role; if (activeDirectoryRole == ActiveDirectoryRole.SchemaRole) { str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext); } else if (activeDirectoryRole == ActiveDirectoryRole.NamingRole) { str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer); } else if (activeDirectoryRole == ActiveDirectoryRole.PdcRole) { str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext); } else if (activeDirectoryRole == ActiveDirectoryRole.RidRole) { str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager); } else if (activeDirectoryRole == ActiveDirectoryRole.InfrastructureRole) { str = this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure); } else { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } 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; }
private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry directoryEntry = null; string domainControllerName = null; try { switch (role) { case ActiveDirectoryRole.PdcRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(base.context, base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext)); break; case ActiveDirectoryRole.RidRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(base.context, base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager)); break; case ActiveDirectoryRole.InfrastructureRole: directoryEntry = DirectoryEntryManager.GetDirectoryEntry(base.context, base.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure)); break; } domainControllerName = Utils.GetDnsHostNameFromNTDSA(base.context, (string) PropertyManager.GetPropertyValue(base.context, directoryEntry, PropertyManager.FsmoRoleOwner)); } catch (COMException exception) { throw ExceptionHelper.GetExceptionFromCOMException(base.context, exception); } finally { if (directoryEntry != null) { directoryEntry.Dispose(); } } return new DomainController(Utils.GetNewDirectoryContext(domainControllerName, DirectoryContextType.DirectoryServer, base.context), domainControllerName); }
private DomainController GetRoleOwner(ActiveDirectoryRole role) { DirectoryEntry directoryEntry = null; string dnsHostNameFromNTDSA = null; using (directoryEntry) { try { ActiveDirectoryRole activeDirectoryRole = role; switch (activeDirectoryRole) { case ActiveDirectoryRole.SchemaRole: { directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext)); break; } case ActiveDirectoryRole.NamingRole: { directoryEntry = DirectoryEntryManager.GetDirectoryEntry(this.context, this.directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer)); break; } } dnsHostNameFromNTDSA = Utils.GetDnsHostNameFromNTDSA(this.context, (string)PropertyManager.GetPropertyValue(this.context, directoryEntry, PropertyManager.FsmoRoleOwner)); } catch (COMException cOMException1) { COMException cOMException = cOMException1; throw ExceptionHelper.GetExceptionFromCOMException(this.context, cOMException); } } DirectoryContext newDirectoryContext = Utils.GetNewDirectoryContext(dnsHostNameFromNTDSA, DirectoryContextType.DirectoryServer, this.context); return new DomainController(newDirectoryContext, dnsHostNameFromNTDSA); }
public int IndexOf(ActiveDirectoryRole role) { throw new NotImplementedException(); }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { // set the "fsmoRoleOwner" attribute on the appropriate role object // to the NTDSAObjectName of this DC string roleObjectDN = null; CheckIfDisposed(); switch (role) { case ActiveDirectoryRole.SchemaRole: { roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.SchemaNamingContext); break; } case ActiveDirectoryRole.NamingRole: { roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.PartitionsContainer); break; } case ActiveDirectoryRole.PdcRole: { roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.DefaultNamingContext); break; } case ActiveDirectoryRole.RidRole: { roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.RidManager); break; } case ActiveDirectoryRole.InfrastructureRole: { roleObjectDN = directoryEntryMgr.ExpandWellKnownDN(WellKnownDN.Infrastructure); break; } default: throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } DirectoryEntry roleObjectEntry = null; try { roleObjectEntry = DirectoryEntryManager.GetDirectoryEntry(context, roleObjectDN); // For RID FSMO role // Increment the RIDAvailablePool by 30k. if (role == ActiveDirectoryRole.RidRole) { System.DirectoryServices.Interop.UnsafeNativeMethods.IADsLargeInteger ridPool = (System.DirectoryServices.Interop.UnsafeNativeMethods.IADsLargeInteger)roleObjectEntry.Properties[PropertyManager.RIDAvailablePool].Value; // check the overflow of the low part if (ridPool.LowPart + UpdateRidPoolSeizureValue < ridPool.LowPart) { throw new InvalidOperationException(Res.GetString(Res.UpdateAvailableRIDPoolOverflowFailure)); } ridPool.LowPart += UpdateRidPoolSeizureValue; roleObjectEntry.Properties[PropertyManager.RIDAvailablePool].Value = ridPool; } 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(ActiveDirectoryRole role) { base.CheckIfDisposed(); if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } 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; } }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { }
public void TransferRoleOwnership(ActiveDirectoryRole role) { }
public void TransferRoleOwnership(ActiveDirectoryRole role) { CheckIfDisposed(); if (role < ActiveDirectoryRole.SchemaRole || role > ActiveDirectoryRole.InfrastructureRole) { throw new InvalidEnumArgumentException("role", (int)role, typeof(ActiveDirectoryRole)); } try { // set the appropriate attribute on the rootDSE 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 int IndexOf(ActiveDirectoryRole role) { }
public bool Contains(ActiveDirectoryRole role) { throw new NotImplementedException(); }
// Methods public bool Contains(ActiveDirectoryRole role) {}
public int IndexOf(ActiveDirectoryRole role) {}
public void CopyTo(ActiveDirectoryRole[] roles, int index) {}
public void TransferRoleOwnership_InvalidRole_ThrowsInvalidEnumArgumentException(ActiveDirectoryRole role) { var controller = new SubController(); AssertExtensions.Throws <InvalidEnumArgumentException>("role", () => controller.TransferRoleOwnership(role)); }
public void SeizeRoleOwnership(ActiveDirectoryRole role) { throw new NotImplementedException(); }