コード例 #1
0
        // Token: 0x060019C2 RID: 6594 RVA: 0x0006C998 File Offset: 0x0006AB98
        internal static ADObjectId GetServerIdFromHomeMta(ADObjectId homeMTA)
        {
            ADObjectId result;

            try
            {
                if (homeMTA == null || string.IsNullOrEmpty(homeMTA.DistinguishedName))
                {
                    result = null;
                }
                else
                {
                    if (homeMTA.Depth - homeMTA.DomainId.Depth > 8)
                    {
                        homeMTA = homeMTA.DescendantDN(8);
                    }
                    result = homeMTA;
                }
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("HomeMtaServerId", ex.Message), ADGroupSchema.HomeMtaServerId, homeMTA), ex);
            }
            return(result);
        }
コード例 #2
0
        // Token: 0x060008D9 RID: 2265 RVA: 0x0001EEA8 File Offset: 0x0001D0A8
        internal static bool HasRole(ADObjectId identity, ServerRole role, IConfigDataProvider session)
        {
            ServerIdParameter serverIdParameter = new ServerIdParameter(identity.DescendantDN(8));

            ServerInfo[] serverInfo = serverIdParameter.GetServerInfo(session);
            return(serverInfo != null && serverInfo.Length == 1 && (serverInfo[0].Role & role) != ServerRole.None);
        }
コード例 #3
0
 internal static void PrepareDomainControllerRecipientSessionForUpdate(IRecipientSession domainControllerSession, ADObjectId recipientId, string domainController, string domainControllerDomainName)
 {
     if (domainControllerSession == null)
     {
         throw new ArgumentNullException("domainControllerSession");
     }
     if (recipientId == null)
     {
         throw new ArgumentNullException("recipientId");
     }
     if (string.IsNullOrEmpty(recipientId.DistinguishedName))
     {
         throw new ArgumentNullException("recipientId.DistinguishedName");
     }
     if (string.Equals(recipientId.DescendantDN(1).Rdn.UnescapedName, "Configuration", StringComparison.OrdinalIgnoreCase))
     {
         domainControllerSession.UseConfigNC      = true;
         domainControllerSession.DomainController = domainController;
         return;
     }
     if (!string.IsNullOrEmpty(domainControllerDomainName) && string.Equals(domainControllerDomainName, DNConvertor.FqdnFromDomainDistinguishedName(recipientId.DomainId.DistinguishedName), StringComparison.InvariantCultureIgnoreCase))
     {
         domainControllerSession.UseConfigNC      = false;
         domainControllerSession.DomainController = domainController;
         return;
     }
     domainControllerSession.UseConfigNC      = false;
     domainControllerSession.DomainController = null;
 }
コード例 #4
0
        internal static object SourceRoutingGroupGetter(IPropertyBag propertyBag)
        {
            object result;

            try
            {
                ADObjectId adobjectId = (ADObjectId)propertyBag[ADObjectSchema.Id];
                if (adobjectId == null)
                {
                    throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("SourceRoutingGroup", string.Empty), SendConnectorSchema.SourceRoutingGroup, propertyBag[ADObjectSchema.Id]), null);
                }
                result = adobjectId.DescendantDN(8);
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("SourceRoutingGroup", ex.Message), SendConnectorSchema.SourceRoutingGroup, propertyBag[ADObjectSchema.Id]), ex);
            }
            return(result);
        }
コード例 #5
0
        internal static object ServerGetter(IPropertyBag propertyBag)
        {
            ADObjectId adobjectId = (ADObjectId)propertyBag[ADObjectSchema.Id];

            if (adobjectId == null)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("Server", string.Empty), ADObjectSchema.Id, adobjectId));
            }
            object result;

            try
            {
                result = adobjectId.DescendantDN(8);
            }
            catch (InvalidOperationException ex)
            {
                throw new DataValidationException(new PropertyValidationError(DirectoryStrings.CannotCalculateProperty("Server", ex.Message), ADObjectSchema.Id, adobjectId), ex);
            }
            return(result);
        }
コード例 #6
0
 private void ValidateSingleADObjectLinkValue(ADPropertyDefinition propertyDefinition, ADObjectId value, List <ValidationError> errors)
 {
     if (this.m_Session != null && this.m_Session.GetType().Name.Equals("TopologyDiscoverySession"))
     {
         return;
     }
     if (this.m_Session != null && !value.IsDescendantOf(this.m_Session.GetRootDomainNamingContext()))
     {
         return;
     }
     if (propertyDefinition.IsValidateInFirstOrganization && this.m_Session != null)
     {
         ADObjectId adobjectId = null;
         try
         {
             adobjectId = this.m_Session.SessionSettings.RootOrgId;
         }
         catch (OrgContainerNotFoundException)
         {
         }
         if (adobjectId != null && !value.IsDescendantOf(adobjectId) && adobjectId.DomainId == value.DomainId && !value.DistinguishedName.ToLower().Contains(",cn=deleted objects,"))
         {
             errors.Add(new PropertyValidationError(DirectoryStrings.ErrorLinkedADObjectNotInFirstOrganization(propertyDefinition.Name, value.ToString(), this.Identity.ToString(), adobjectId.ToString()), propertyDefinition, value));
             return;
         }
     }
     else if (propertyDefinition.IsValidateInSameOrganization)
     {
         if (this.OrganizationId.Equals(OrganizationId.ForestWideOrgId) && this.m_Session != null)
         {
             ADObjectId adobjectId2 = null;
             try
             {
                 adobjectId2 = this.m_Session.SessionSettings.RootOrgId;
             }
             catch (OrgContainerNotFoundException)
             {
             }
             catch (TenantOrgContainerNotFoundException)
             {
             }
             bool flag = true;
             try
             {
                 if (adobjectId2 != null && adobjectId2.DescendantDN(1).Name.ToLower().Equals("configuration"))
                 {
                     flag = false;
                 }
             }
             catch (InvalidOperationException)
             {
             }
             if (adobjectId2 != null && flag)
             {
                 ADObjectId childId = value.DomainId.GetChildId("OU", "Microsoft Exchange Hosted Organizations");
                 ADObjectId configurationUnitsRoot = this.m_Session.GetConfigurationUnitsRoot();
                 if ((value.IsDescendantOf(childId) || value.IsDescendantOf(configurationUnitsRoot)) && (!(this is ADConfigurationObject) || !base.Id.IsDescendantOf(configurationUnitsRoot)))
                 {
                     errors.Add(new PropertyValidationError(DirectoryStrings.ErrorLinkedADObjectNotInSameOrganization(propertyDefinition.Name, value.ToString(), this.Identity.ToString(), this.OrganizationId.ToString()), propertyDefinition, value));
                     return;
                 }
             }
         }
         else if (!this.OrganizationId.Equals(OrganizationId.ForestWideOrgId) && !value.DistinguishedName.ToLower().Contains(",cn=deleted objects,") && !value.IsDescendantOf(this.OrganizationId.OrganizationalUnit) && !value.IsDescendantOf(this.OrganizationId.ConfigurationUnit) && (!propertyDefinition.IsValidateInSharedConfig || this.SharedConfiguration == null || !value.IsDescendantOf(this.SharedConfiguration)))
         {
             errors.Add(new PropertyValidationError(DirectoryStrings.ErrorLinkedADObjectNotInSameOrganization(propertyDefinition.Name, value.ToString(), this.Identity.ToString(), this.OrganizationId.ToString()), propertyDefinition, value));
         }
     }
 }