// Token: 0x06001083 RID: 4227 RVA: 0x000601E4 File Offset: 0x0005E3E4
 public GroupMetricsSyncType UpdateGroupMetrics(GroupMetricsGeneratorTaskContext context)
 {
     try
     {
         if (context.LastProcessedGroupDistinguishedName == null)
         {
             CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(base.OrgId, CachedOrganizationConfiguration.ConfigurationTypes.Domains);
             this.domains        = instance.Domains;
             this.updatedCookies = new List <GroupMetricsCookie>();
             bool flag;
             if (!this.TryDeltaSync(out flag, this.updatedCookies))
             {
                 this.updatedCookies.Clear();
                 if (!flag || !this.TryFullSync(this.updatedCookies))
                 {
                     this.lastSyncType = GroupMetricsSyncType.Failed;
                 }
             }
         }
         if (!this.GetMetricsForChangedGroups(context))
         {
             this.lastSyncType = GroupMetricsSyncType.Failed;
         }
     }
     catch (Exception ex)
     {
         this.exception    = ex;
         this.lastSyncType = GroupMetricsSyncType.Failed;
         return(this.lastSyncType);
     }
     return(this.lastSyncType);
 }
Beispiel #2
0
 public MailTips(RecipientData recipientData) : this(recipientData.EmailAddress)
 {
     this.recipientData = recipientData;
     if (!recipientData.IsEmpty)
     {
         this.configuration = CachedOrganizationConfiguration.GetInstance(recipientData.OrganizationId, CachedOrganizationConfiguration.ConfigurationTypes.All);
         return;
     }
     this.permission = MailTipsPermission.AllAccess;
 }
Beispiel #3
0
        // Token: 0x0600081A RID: 2074 RVA: 0x0003BF24 File Offset: 0x0003A124
        private string GetAccessProxyAddress()
        {
            string result = string.Empty;
            CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(OrganizationId.ForestWideOrgId, CachedOrganizationConfiguration.ConfigurationTypes.All);
            Organization configuration = instance.OrganizationConfiguration.Configuration;
            ProtocolConnectionSettings sipaccessService = configuration.SIPAccessService;

            if (sipaccessService != null)
            {
                result = sipaccessService.Hostname.ToString();
            }
            return(result);
        }
Beispiel #4
0
        public static bool IsMemberOf(string emailAddress, RoutingAddress distributionListRoutingAddress, OrganizationId organizationId)
        {
            if (string.IsNullOrEmpty(emailAddress))
            {
                throw new ArgumentNullException("emailAddress");
            }
            if (organizationId == null)
            {
                throw new ArgumentNullException("organizationId");
            }
            if (!SmtpAddress.IsValidSmtpAddress(emailAddress))
            {
                throw new ArgumentException(string.Format("emailAddress:{0} is not a valid ProxyAddress", emailAddress));
            }
            UserIdentity userIdentity = ADIdentityInformationCache.Singleton.GetUserIdentity(emailAddress, ADUtils.ADRecipientSessionContext);
            Guid         objectGuid   = userIdentity.ObjectGuid;
            CachedOrganizationConfiguration cachedOrganizationConfiguration = ADUtils.GetCachedOrganizationConfiguration(organizationId);

            return(cachedOrganizationConfiguration.GroupsConfiguration.IsMemberOf(objectGuid, distributionListRoutingAddress));
        }
Beispiel #5
0
        // Token: 0x060010B9 RID: 4281 RVA: 0x000622E8 File Offset: 0x000604E8
        internal static bool GroupMetricsEnabledByOrgConfig(OrganizationId organizationId)
        {
            bool enabled = false;
            ADOperationResult adoperationResult = ADNotificationAdapter.TryRunADOperation(delegate()
            {
                CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(organizationId, CachedOrganizationConfiguration.ConfigurationTypes.OrganizationConfiguration);
                Organization configuration = instance.OrganizationConfiguration.Configuration;
                enabled = configuration.MailTipsGroupMetricsEnabled;
                GroupMetricsUtility.Tracer.TraceDebug <OrganizationId, bool>(0L, "GroupMetricsEnabledByOrgConfig: OrgId {0} result {1}", organizationId, enabled);
            }, 3);

            if (adoperationResult.Succeeded)
            {
                return(enabled);
            }
            GroupMetricsUtility.Tracer.TraceDebug <string, string>(0L, "GroupMetricsEnabledByOrgConfig failed: {0}, {1}", adoperationResult.Exception.GetType().FullName, adoperationResult.Exception.Message);
            GroupMetricsUtility.Logger.LogEvent(InfoWorkerEventLogConstants.Tuple_UnableToReadConfigurationFromAD, null, new object[]
            {
                adoperationResult.Exception.GetType().FullName,
                adoperationResult.Exception.Message
            });
            return(false);
        }
        internal static ISmimeSettingsProvider ReadSmimeSettingsFromAd(OrganizationId organizationId)
        {
            CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(organizationId, TimeSpan.FromHours(1.0), CachedOrganizationConfiguration.ConfigurationTypes.All);

            return(instance.SmimeSettings.Configuration);
        }
Beispiel #7
0
 private static CachedOrganizationConfiguration GetCachedOrganizationConfiguration(OrganizationId organizationId)
 {
     return(CachedOrganizationConfiguration.GetInstance(organizationId, CachedOrganizationConfiguration.ConfigurationTypes.GroupsConfiguration));
 }
 public void Get()
 {
     ExTraceGlobals.MailCallTracer.TraceDebug((long)this.GetHashCode(), "ClientCacheEventHandler.Get");
     base.ResponseContentType = OwaEventContentType.Javascript;
     this.Writer.WriteLine("{");
     this.Writer.Write("sAcc : \"");
     using (RecipientWellEventHandler recipientWellObject = new RecipientWellEventHandler())
     {
         RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
         {
             using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
             {
                 recipientWellObject.GetCache(textWriter, this.OwaContext, this.UserContext);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
         }, this.GetHashCode());
     }
     this.Writer.WriteLine("\",");
     this.Writer.Write("sPr : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         RecipientInfoCacheEntry entry = AutoCompleteCacheEntry.ParseLogonExchangePrincipal(base.UserContext.ExchangePrincipal, base.UserContext.SipUri, base.UserContext.MobilePhoneNumber);
         using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
         {
             AutoCompleteCacheEntry.RenderEntryJavascript(textWriter, entry);
             Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext);
         SendAddressDefaultSetting sendAddressDefaultSetting = new SendAddressDefaultSetting(base.UserContext);
         SubscriptionCacheEntry subscriptionCacheEntry;
         if (cache.TryGetSendAsDefaultEntry(sendAddressDefaultSetting, out subscriptionCacheEntry))
         {
             this.Writer.Write("sDfltFr : \"");
             using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
             {
                 subscriptionCacheEntry.RenderToJavascript(textWriter);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
             this.Writer.WriteLine("\",");
         }
     }, this.GetHashCode());
     this.Writer.Write("sSc : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SubscriptionCache cache = SubscriptionCache.GetCache(base.UserContext);
         using (TextWriter textWriter = new StringWriter(CultureInfo.InvariantCulture))
         {
             cache.RenderToJavascript(textWriter);
             Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     this.Writer.Write("sMruc : \"");
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         SendFromCache sendFromCache = SendFromCache.TryGetCache(base.UserContext);
         if (sendFromCache != null)
         {
             using (TextWriter textWriter = new StringWriter())
             {
                 sendFromCache.RenderToJavascript(textWriter);
                 Utilities.JavascriptEncode(textWriter.ToString(), this.Writer);
             }
         }
     }, this.GetHashCode());
     this.Writer.WriteLine("\",");
     this.Writer.Write("sLng : '");
     Utilities.JavascriptEncode(base.UserContext.UserCulture.Name, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("iThmId : ");
     this.Writer.Write(ThemeManager.GetIdFromStorageId(base.UserContext.UserOptions.ThemeStorageId));
     this.Writer.WriteLine(",");
     this.Writer.Write("sSigHtml : '");
     RenderingUtilities.RenderSignature(this.Writer, base.UserContext, true);
     this.Writer.WriteLine("',");
     this.Writer.Write("sSigTxt : '");
     RenderingUtilities.RenderSignature(this.Writer, base.UserContext, false);
     this.Writer.WriteLine("',");
     this.Writer.Write("fSig : ");
     this.Writer.Write((base.UserContext.IsFeatureEnabled(Feature.Signature) && base.UserContext.UserOptions.AutoAddSignature) ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fSp : '");
     this.Writer.Write(base.UserContext.IsFeatureEnabled(Feature.SpellChecker));
     this.Writer.WriteLine("',");
     this.Writer.Write("iSp : '");
     this.Writer.Write(base.UserContext.UserOptions.SpellingDictionaryLanguage);
     this.Writer.WriteLine("',");
     this.Writer.Write("fSpSn : ");
     this.Writer.Write(base.UserContext.UserOptions.SpellingCheckBeforeSend ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("iFmtBrSt : ");
     this.Writer.Write((int)base.UserContext.UserOptions.FormatBarState);
     this.Writer.WriteLine(",");
     this.Writer.Write("sMruFnts : '");
     Utilities.JavascriptEncode(base.UserContext.UserOptions.MruFonts, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("sInitFntNm : '");
     Utilities.JavascriptEncode(base.UserContext.UserOptions.ComposeFontName, this.Writer);
     this.Writer.WriteLine("',");
     this.Writer.Write("sInitFntSz : '");
     this.Writer.Write(base.UserContext.UserOptions.ComposeFontSize);
     this.Writer.WriteLine("',");
     this.Writer.Write("sDefFntStyl : '");
     RenderingUtilities.RenderDefaultFontStyle(this.Writer, base.UserContext);
     this.Writer.WriteLine("',");
     this.Writer.Write("fDefFntBold : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Bold));
     this.Writer.WriteLine(",");
     this.Writer.Write("fDefFntItalc : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Italic));
     this.Writer.WriteLine(",");
     this.Writer.Write("fDefFntUndl : ");
     this.Writer.Write((int)(base.UserContext.UserOptions.ComposeFontFlags & FontFlags.Underline));
     this.Writer.WriteLine(",");
     this.Writer.Write("fTxt : ");
     this.Writer.Write((int)base.UserContext.UserOptions.ComposeMarkup);
     this.Writer.WriteLine(",");
     this.Writer.Write("fShwBcc : ");
     this.Writer.Write(base.UserContext.UserOptions.AlwaysShowBcc ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fShwFrm : ");
     this.Writer.Write(base.UserContext.UserOptions.AlwaysShowFrom ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fAEnc : ");
     this.Writer.Write(OwaRegistryKeys.AlwaysEncrypt ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fASgn : ");
     this.Writer.Write(OwaRegistryKeys.AlwaysSign ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fSgn : ");
     this.Writer.Write(base.UserContext.UserOptions.SmimeSign ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fEnc : ");
     this.Writer.Write(base.UserContext.UserOptions.SmimeEncrypt ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("fMstUpd : ");
     this.Writer.WriteLine(OwaRegistryKeys.ForceSMimeClientUpgrade ? 1 : 0);
     this.Writer.WriteLine(",");
     this.Writer.Write("oMailTipsConfig : {");
     this.Writer.Write("'fHideByDefault' : ");
     this.Writer.Write(base.UserContext.UserOptions.HideMailTipsByDefault ? 1 : 0);
     RecipientCache.RunGetCacheOperationUnderDefaultExceptionHandler(delegate
     {
         CachedOrganizationConfiguration instance = CachedOrganizationConfiguration.GetInstance(base.UserContext.ExchangePrincipal.MailboxInfo.OrganizationId, CachedOrganizationConfiguration.ConfigurationTypes.All);
         this.Writer.Write(",");
         this.Writer.Write("'fEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsAllTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fMailboxEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsMailboxSourcedTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fGroupMetricsEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsGroupMetricsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'fExternalEnabled' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsExternalRecipientsTipsEnabled ? 1 : 0);
         this.Writer.Write(",");
         this.Writer.Write("'iLargeAudienceThreshold' : ");
         this.Writer.Write(instance.OrganizationConfiguration.Configuration.MailTipsLargeAudienceThreshold);
     }, this.GetHashCode());
     this.Writer.Write("}");
     this.Writer.Write("}");
 }
        private IEnumerable <MailTips> GetMailTipsInBatches(MailTipsState mailTipsState)
        {
            Exception ex = null;

            try
            {
                using (IStandardBudget standardBudget = StandardBudget.Acquire(mailTipsState.ClientSecurityContext.UserSid, BudgetType.Owa, ADSessionSettings.FromRootOrgScopeSet()))
                {
                    string callerInfo = "MailTipsNotificationHandler.GetMailTipsInBatches";
                    standardBudget.CheckOverBudget();
                    standardBudget.StartConnection(callerInfo);
                    standardBudget.StartLocal(callerInfo, default(TimeSpan));
                    mailTipsState.Budget = standardBudget;
                    ClientContext clientContext = ClientContext.Create(mailTipsState.ClientSecurityContext, mailTipsState.Budget, mailTipsState.LogonUserTimeZone, mailTipsState.LogonUserCulture);
                    ((InternalClientContext)clientContext).QueryBaseDN = mailTipsState.QueryBaseDn;
                    ExTraceGlobals.CoreCallTracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "QueryBaseDN set to {0}", mailTipsState.QueryBaseDn);
                    ProxyAddress sendingAsProxyAddress = this.GetSendingAsProxyAddress(mailTipsState);
                    mailTipsState.CachedOrganizationConfiguration = CachedOrganizationConfiguration.GetInstance(mailTipsState.LogonUserOrgId, CachedOrganizationConfiguration.ConfigurationTypes.All);
                    ExTraceGlobals.CoreCallTracer.TraceDebug <OrganizationId>((long)this.GetHashCode(), "Organization ID = {0}", mailTipsState.LogonUserOrgId);
                    try
                    {
                        int num = 0;
                        do
                        {
                            ProxyAddress[] nextBatch = MailTipsNotificationHandler.GetNextBatch(mailTipsState.RecipientsInfo, ref num);
                            mailTipsState.GetMailTipsQuery            = new GetMailTipsQuery(this.GetHashCode(), clientContext, sendingAsProxyAddress, mailTipsState.CachedOrganizationConfiguration, nextBatch, MailTipTypes.OutOfOfficeMessage | MailTipTypes.MailboxFullStatus | MailTipTypes.CustomMailTip | MailTipTypes.ExternalMemberCount | MailTipTypes.TotalMemberCount | MailTipTypes.DeliveryRestriction | MailTipTypes.ModerationStatus, mailTipsState.LogonUserCulture.LCID, mailTipsState.Budget, null);
                            mailTipsState.GetMailTipsQuery.ServerName = mailTipsState.ServerName;
                            mailTipsState.RequestLogger = mailTipsState.GetMailTipsQuery.RequestLogger;
                            IEnumerable <MailTips> collection = mailTipsState.GetMailTipsQuery.Execute();
                            mailTipsState.MailTipsResult.AddRange(collection);
                        }while (num < mailTipsState.RecipientsInfo.Length);
                    }
                    catch (UserWithoutFederatedProxyAddressException ex2)
                    {
                        ex = ex2;
                    }
                    catch (InvalidFederatedOrganizationIdException ex3)
                    {
                        ex = ex3;
                    }
                }
            }
            catch (OverBudgetException ex4)
            {
                ex = ex4;
            }
            catch (ObjectDisposedException ex5)
            {
                ex = ex5;
            }
            catch (OwaInvalidOperationException ex6)
            {
                ex = ex6;
            }
            finally
            {
                if (ex != null)
                {
                    MailTipsNotificationHandler.PopulateException(mailTipsState, ex, this.GetHashCode());
                }
            }
            return(mailTipsState.MailTipsResult);
        }