コード例 #1
0
        private static ADUser GetOrganizationMailbox(IRecipientSession recipientSession, OrganizationCapability capability, string anchorMailboxKey)
        {
            if (recipientSession == null)
            {
                throw new ArgumentNullException("recipientSession");
            }
            List <ADUser> organizationMailboxesByCapability = OrganizationMailbox.GetOrganizationMailboxesByCapability(recipientSession, capability);

            if (organizationMailboxesByCapability == null || organizationMailboxesByCapability.Count == 0)
            {
                ExTraceGlobals.CafeTracer.TraceError <OrganizationCapability, OrganizationId>(0L, "[HttpProxyBackEndHelper.GetOrganizationMailbox] Unable to find organization mailbox with capability {0} for organization {1}.", capability, recipientSession.SessionSettings.CurrentOrganizationId);
                return(null);
            }
            ADUser aduser;

            if (!string.IsNullOrEmpty(anchorMailboxKey) && organizationMailboxesByCapability.Count > 1)
            {
                aduser = organizationMailboxesByCapability[HttpProxyBackEndHelper.ComputeIndex(anchorMailboxKey, organizationMailboxesByCapability.Count)];
            }
            else
            {
                aduser = organizationMailboxesByCapability[0];
            }
            ExTraceGlobals.CafeTracer.TraceDebug <ObjectId, OrganizationCapability, OrganizationId>(0L, "[HttpProxyBackEndHelper.GetOrganizationMailbox] Find organization mailbox {0} with capability {1} for organization {2}.", aduser.Identity, capability, recipientSession.SessionSettings.CurrentOrganizationId);
            return(aduser);
        }
コード例 #2
0
        internal static ADUser GetDefaultOrganizationMailbox(IRecipientSession recipientSession, string anchorMailboxKey = null)
        {
            if (recipientSession == null)
            {
                throw new ArgumentNullException("recipientSession");
            }
            ADUser aduser = HttpProxyBackEndHelper.GetOrganizationMailbox(recipientSession, HttpProxyBackEndHelper.DefaultOrganizationCapability, anchorMailboxKey);

            if (aduser == null)
            {
                ADUser[] array = recipientSession.FindADUser(null, QueryScope.SubTree, HttpProxyBackEndHelper.E15OrganizationMailboxFilter, null, 1);
                if (array.Length == 0)
                {
                    ExTraceGlobals.CafeTracer.TraceError <OrganizationId>(0L, "[HttpProxyBackEndHelper.GetDefaultOrganizationMailbox] Unable to find E15 organization mailbox by name for organization {0}.", recipientSession.SessionSettings.CurrentOrganizationId);
                    array = recipientSession.FindADUser(null, QueryScope.SubTree, HttpProxyBackEndHelper.E14EDiscoveryMailboxFilter, null, 1);
                    if (array.Length == 0)
                    {
                        ExTraceGlobals.CafeTracer.TraceError <OrganizationId>(0L, "[HttpProxyBackEndHelper.GetDefaultOrganizationMailbox] Unable to find E14 eDiscovery mailbox by name for organization {0}.", recipientSession.SessionSettings.CurrentOrganizationId);
                    }
                    else
                    {
                        aduser = array[HttpProxyBackEndHelper.ComputeIndex(anchorMailboxKey, array.Length)];
                        ExTraceGlobals.CafeTracer.TraceDebug <ObjectId, OrganizationId>(0L, "[HttpProxyBackEndHelper.GetDefaultOrganizationMailbox] Found E14 eDiscovery mailbox {0} by name for organization {1}.", aduser.Identity, recipientSession.SessionSettings.CurrentOrganizationId);
                    }
                }
                else
                {
                    aduser = array[HttpProxyBackEndHelper.ComputeIndex(anchorMailboxKey, array.Length)];
                    ExTraceGlobals.CafeTracer.TraceDebug <ObjectId, OrganizationId>(0L, "[HttpProxyBackEndHelper.GetDefaultOrganizationMailbox] Found E15 eDiscovery mailbox {0} by name for organization {1}.", aduser.Identity, recipientSession.SessionSettings.CurrentOrganizationId);
                }
            }
            return(aduser);
        }
コード例 #3
0
 internal static BackEndServer GetDeterministicBackEndServer <ServiceType>(BackEndServer mailboxServer, string identifier, ClientAccessType clientAccessType) where ServiceType : HttpService
 {
     if (mailboxServer == null)
     {
         throw new ArgumentNullException("mailboxServer");
     }
     if (string.IsNullOrEmpty(identifier))
     {
         throw new ArgumentNullException("identifier");
     }
     if (VariantConfiguration.InvariantNoFlightingSnapshot.Global.MultiTenancy.Enabled && VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Cafe.ServersCache.Enabled)
     {
         MiniServer deterministicBackEndServerFromSameSite = ServersCache.GetDeterministicBackEndServerFromSameSite(mailboxServer.Fqdn, Server.E15MinVersion, identifier, false);
         return(new BackEndServer(deterministicBackEndServerFromSameSite.Fqdn, deterministicBackEndServerFromSameSite.VersionNumber));
     }
     HttpProxyBackEndHelper.TopologyWithSites completeServiceTopologyWithSites = HttpProxyBackEndHelper.GetCompleteServiceTopologyWithSites(mailboxServer.Fqdn);
     HttpService[] array = (HttpService[])HttpProxyBackEndHelper.FindAcceptableBackEndService <ServiceType>(completeServiceTopologyWithSites, clientAccessType, (int x) => x >= Server.E15MinVersion);
     if (array.Length > 0)
     {
         int num = HttpProxyBackEndHelper.ComputeIndex(identifier, array.Length);
         ExTraceGlobals.CafeTracer.TraceDebug <int, string, int>(0L, "[HttpProxyBackEndHelper.GetDeterministicBackEndServer] Buckets: {0} Identifier: {1} Index: {2}", array.Length, identifier, num);
         return(new BackEndServer(array[num].ServerFullyQualifiedDomainName, array[num].ServerVersionNumber));
     }
     throw new ServerNotFoundException("Unable to find proper HTTP service.");
 }