예제 #1
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);
        }
예제 #2
0
        internal override bool CheckForAssociatedUsers()
        {
            ADSessionSettings sessionSettings = ADSessionSettings.FromOrganizationIdWithoutRbacScopes(ADSystemConfigurationSession.GetRootOrgContainerIdForLocalForest(), base.OrganizationId, null, false);
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 2539, "CheckForAssociatedUsers", "f:\\15.00.1497\\sources\\dev\\data\\src\\directory\\SystemConfiguration\\OwaMailboxPolicy.cs");
            QueryFilter       filter = new ComparisonFilter(ComparisonOperator.Equal, ADUserSchema.OwaMailboxPolicy, base.Id);

            ADUser[] array = tenantOrRootOrgRecipientSession.FindADUser(null, QueryScope.SubTree, filter, null, 1);
            return(array != null && array.Length > 0);
        }
예제 #3
0
        internal static ADUser GetE14EDiscoveryMailbox(IRecipientSession recipientSession)
        {
            ADUser result = null;

            ADUser[] array = recipientSession.FindADUser(null, QueryScope.SubTree, HttpProxyBackEndHelper.E14EDiscoveryMailboxFilter, null, 1);
            if (array.Length == 0)
            {
                ExTraceGlobals.CafeTracer.TraceError <OrganizationId>(0L, "[HttpProxyBackEndHelper.GetE14EDiscoveryMailbox] Unable to find E14 eDiscovery mailbox by name for organization {0}.", recipientSession.SessionSettings.CurrentOrganizationId);
            }
            else
            {
                result = array[0];
            }
            return(result);
        }
예제 #4
0
        private static ADUser GetPublicFolderHierarchyMailboxUser(IConfigurationSession configurationSession)
        {
            PublicFolderInformation defaultPublicFolderMailbox = configurationSession.GetOrgContainer().DefaultPublicFolderMailbox;
            Guid hierarchyMailboxGuid = defaultPublicFolderMailbox.HierarchyMailboxGuid;

            if (defaultPublicFolderMailbox.Type != PublicFolderInformation.HierarchyType.MailboxGuid || hierarchyMailboxGuid == Guid.Empty)
            {
                return(null);
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(true, ConsistencyMode.FullyConsistent, configurationSession.SessionSettings, 136, "GetPublicFolderHierarchyMailboxUser", "f:\\15.00.1497\\sources\\dev\\Management\\src\\Management\\MapiTasks\\PublicFolderPermission\\PublicFolderPermissionTaskHelper.cs");

            ADUser[] array = tenantOrRootOrgRecipientSession.FindADUser(null, QueryScope.SubTree, new AndFilter(new QueryFilter[]
            {
                new ComparisonFilter(ComparisonOperator.Equal, ADMailboxRecipientSchema.ExchangeGuid, hierarchyMailboxGuid),
                Filters.GetRecipientTypeDetailsFilterOptimization(RecipientTypeDetails.PublicFolderMailbox)
            }), null, 1);
            if (array.Length <= 0)
            {
                return(null);
            }
            return(array[0]);
        }
예제 #5
0
        private ADUser GetMonitoringMailbox(MailboxDatabase mdb, Server activeServer)
        {
            string monitoringMailboxDisplayName = this.GetMonitoringMailboxDisplayName(mdb, activeServer);

            if (string.IsNullOrEmpty(monitoringMailboxDisplayName))
            {
                return(null);
            }
            QueryFilter       queryFilter  = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.DisplayName, monitoringMailboxDisplayName);
            QueryFilter       queryFilter2 = new ComparisonFilter(ComparisonOperator.Equal, ADRecipientSchema.RecipientTypeDetailsValue, RecipientTypeDetails.MonitoringMailbox);
            IRecipientSession recipientSessionForMonitoringMailbox = this.GetRecipientSessionForMonitoringMailbox();

            ADUser[] array = recipientSessionForMonitoringMailbox.FindADUser(null, QueryScope.SubTree, new AndFilter(new QueryFilter[]
            {
                queryFilter,
                queryFilter2
            }), null, 1000);
            if (array != null)
            {
                return(array.FirstOrDefault <ADUser>());
            }
            return(null);
        }
예제 #6
0
        public override string Lookup(out SecurityIdentifier sid)
        {
            sid = null;
            ADSessionSettings sessionSettings;

            try
            {
                sessionSettings = ADSessionSettings.RootOrgOrSingleTenantFromAcceptedDomainAutoDetect(this.smtpAddress.Domain);
            }
            catch (CannotResolveTenantNameException arg)
            {
                ExTraceGlobals.SharingTracer.TraceError <SmtpAddress, CannotResolveTenantNameException>((long)this.GetHashCode(), "PublicUrlKey.Lookup(): Cannot resolve tenant name for address {0}.Error: {1}", this.smtpAddress, arg);
                return(null);
            }
            IRecipientSession tenantOrRootOrgRecipientSession = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(ConsistencyMode.PartiallyConsistent, sessionSettings, 79, "Lookup", "f:\\15.00.1497\\sources\\dev\\data\\src\\storage\\Sharing\\PublicUrlKey.cs");

            ADUser[] array = tenantOrRootOrgRecipientSession.FindADUser(null, QueryScope.SubTree, this.filterBySmtpAddress, null, 1);
            if (array == null || array.Length == 0)
            {
                ExTraceGlobals.SharingTracer.TraceError <SmtpAddress>((long)this.GetHashCode(), "PublicUrlKey.Lookup(): Cannot find ADUser object for smtp address {0}.", this.smtpAddress);
                return(null);
            }
            ADUser aduser = array[0];

            sid = aduser.Sid;
            string folder = aduser.SharingAnonymousIdentities.GetFolder(this.urlId);

            if (string.IsNullOrEmpty(folder))
            {
                ExTraceGlobals.SharingTracer.TraceDebug <SmtpAddress, string>((long)this.GetHashCode(), "PublicUrlKey.Lookup(): Not found sharing anonymous identity for user {0} with url id {1}.", this.smtpAddress, this.urlId);
            }
            else
            {
                ExTraceGlobals.SharingTracer.TraceDebug <SmtpAddress, string, string>((long)this.GetHashCode(), "PublicUrlKey.Lookup(): Get sharing anonymous identity for user {0} with url id {1}: Folder Id = {2}.", this.smtpAddress, this.urlId, folder);
            }
            return(folder);
        }