Пример #1
0
        // Token: 0x06001D5A RID: 7514 RVA: 0x000750BC File Offset: 0x000732BC
        private static void GetUserIdentity(HttpContext httpContext, out Guid userObjectGuid, out Guid tenantGuid, out OrganizationId orgId, out UserContext userContext)
        {
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug(0L, "Entering SpeechRecognitionProcessor.GetUserIdentity");
            userContext    = UserContextManager.GetUserContext(httpContext);
            userObjectGuid = userContext.ExchangePrincipal.ObjectId.ObjectGuid;
            orgId          = userContext.ExchangePrincipal.MailboxInfo.OrganizationId;
            IADSystemConfigurationLookup iadsystemConfigurationLookup = ADSystemConfigurationLookupFactory.CreateFromOrganizationId(orgId);

            tenantGuid = iadsystemConfigurationLookup.GetExternalDirectoryOrganizationId();
            ExTraceGlobals.SpeechRecognitionTracer.TraceDebug <Guid, Guid, OrganizationId>(0L, "SpeechRecognitionProcessor.GetUserIdentity - userObjectGuid='{0}', tenantGuid='{1}', orgId='{2}'", userObjectGuid, tenantGuid, orgId);
        }
        // Token: 0x060019EE RID: 6638 RVA: 0x0005D5FC File Offset: 0x0005B7FC
        protected override string InternalExecute()
        {
            UserContext            userContext = UserContextManager.GetUserContext(base.CallContext.HttpContext, base.CallContext.EffectiveCaller, true);
            AttachmentDataProvider defaultUploadDataProvider = userContext.AttachmentDataProviderManager.GetDefaultUploadDataProvider(base.CallContext);

            if (defaultUploadDataProvider is OneDriveProAttachmentDataProvider)
            {
                return(((OneDriveProAttachmentDataProvider)defaultUploadDataProvider).GetUploadFolderName(userContext));
            }
            return(null);
        }
Пример #3
0
        // Token: 0x060018ED RID: 6381 RVA: 0x00056A8C File Offset: 0x00054C8C
        private static bool GetPreviewsDisabled()
        {
            bool        result      = true;
            HttpContext httpContext = HttpContext.Current;

            if (httpContext != null && UserContextManager.GetUserContext(httpContext).FeaturesManager != null)
            {
                result = !UserContextManager.GetUserContext(httpContext).FeaturesManager.ClientServerSettings.InlinePreview.Enabled;
            }
            return(result);
        }
Пример #4
0
        protected override int InternalExecute()
        {
            UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);

            if (userContext != null)
            {
                userContext.UpdateLastUserRequestTime();
                return(0);
            }
            return(-10);
        }
        // Token: 0x0600105A RID: 4186 RVA: 0x0003ED74 File Offset: 0x0003CF74
        private void NoActiveListeners(object sender, RemoteSubscriptionEventArgs eventArgs)
        {
            UserContextKey userContextKey;

            if (this.TryParseUserContextKey(eventArgs.ContextKey, out userContextKey))
            {
                IMailboxContext mailboxContextFromCache = UserContextManager.GetMailboxContextFromCache(userContextKey);
                if (mailboxContextFromCache != null)
                {
                    mailboxContextFromCache.NotificationManager.ReleaseSubscription(eventArgs.SubscriptionId);
                }
            }
        }
Пример #6
0
        public AttachmentDataProvider GetProvider(CallContext callContext, string id)
        {
            this.EnsureAttachmentDataProviders(callContext);
            if (this.dataProviders.ContainsKey(id))
            {
                return(this.dataProviders[id]);
            }
            ExTraceGlobals.DocumentsTracer.TraceDebug <string>((long)this.GetHashCode(), "Provider with id {0} was not found, getting the default upload provider", id);
            UserContext userContext = UserContextManager.GetUserContext(callContext.HttpContext, callContext.EffectiveCaller, true);

            OwaServerTraceLogger.AppendToLog(new TraceLogEvent("ADPM.GP", userContext, "GetProvider", string.Format("Provider with id {0} was not found", id)));
            return(this.GetDefaultUploadDataProvider(callContext));
        }
        // Token: 0x060019F9 RID: 6649 RVA: 0x0005DBD8 File Offset: 0x0005BDD8
        protected override NavBarData InternalExecute()
        {
            AuthZClientInfo effectiveCaller = CallContext.Current.EffectiveCaller;
            UserContext     userContext     = UserContextManager.GetUserContext(CallContext.Current.HttpContext, effectiveCaller, true);

            if (!userContext.IsBposUser)
            {
                return(null);
            }
            BposNavBarInfoAssetReader bposNavBarInfoAssetReader = userContext.BposNavBarInfoAssetReader;

            return(bposNavBarInfoAssetReader.GetData(effectiveCaller).NavBarData);
        }
Пример #8
0
        internal string GetThemeFolderName(UserAgent agent, HttpContext httpContext)
        {
            Theme theme = this.BaseTheme;

            if (agent != null && httpContext != null && !UserAgentUtilities.IsMonitoringRequest(agent.RawString) && agent.Layout == LayoutType.Mouse && !Globals.IsAnonymousCalendarApp)
            {
                UserContext userContext = UserContextManager.GetUserContext(httpContext);
                if (userContext != null)
                {
                    theme = userContext.Theme;
                }
            }
            return(theme.FolderName);
        }
        // Token: 0x06001A2B RID: 6699 RVA: 0x0005F604 File Offset: 0x0005D804
        protected override ScopeFlightsSetting[] InternalExecute()
        {
            UserContext userContext = UserContextManager.GetUserContext(base.CallContext.HttpContext);

            if (!userContext.FeaturesManager.ClientServerSettings.FlightsView.Enabled)
            {
                throw new OwaNotSupportedException("This method is not supported.");
            }
            IList <ScopeFlightsSetting> flightsForScope = this.scopeFlightsSettingsProvider.GetFlightsForScope();
            ScopeFlightsSetting         item            = new ScopeFlightsSetting(userContext.PrimarySmtpAddress.ToString(), userContext.FeaturesManager.ConfigurationSnapshot.Flights);

            flightsForScope.Add(item);
            return(flightsForScope.ToArray <ScopeFlightsSetting>());
        }
Пример #10
0
        private static UserContextKey GetUserContextKey(HttpContext httpContext, ClientSecurityContext overrideClientSecurityContext, out UserContextCookie userContextCookie)
        {
            UserContextKey userContextKey    = null;
            string         explicitLogonUser = UserContextUtilities.GetExplicitLogonUser(httpContext);

            if (string.IsNullOrEmpty(explicitLogonUser))
            {
                userContextCookie = UserContextCookie.GetUserContextCookie(httpContext);
                if (userContextCookie != null)
                {
                    ExTraceGlobals.UserContextCallTracer.TraceDebug <UserContextCookie>(0L, "Found cookie in the request: {0}", userContextCookie);
                    if (overrideClientSecurityContext == null)
                    {
                        userContextKey = UserContextKey.CreateFromCookie(userContextCookie, httpContext);
                    }
                    else
                    {
                        userContextKey = UserContextKey.CreateFromCookie(userContextCookie, overrideClientSecurityContext.UserSid);
                    }
                }
            }
            else
            {
                userContextCookie = null;
                if (UserContextManager.RequestRequiresSharedContext(httpContext))
                {
                    userContextKey = UserContextKey.Create("D894745CADD64DB9B00309200288E1E7", "SharedAdmin", explicitLogonUser);
                }
                else
                {
                    SecurityIdentifier securityIdentifier = httpContext.User.Identity.GetSecurityIdentifier();
                    if (securityIdentifier == null)
                    {
                        ExTraceGlobals.UserContextCallTracer.TraceDebug <IIdentity>(0L, "UserContextManager.GetUserContextKey: current user has no security identifier - '{0}'", httpContext.User.Identity);
                        ExWatson.SendReport(new InvalidOperationException(string.Format("UserContextManager.GetUserContextKey: current user has no security identifier - '{0}'", httpContext.User.Identity)), ReportOptions.None, null);
                        return(null);
                    }
                    string logonUniqueKey = securityIdentifier.ToString();
                    string text           = httpContext.Request.Headers["X-OWA-Test-ExplicitLogonUserId"];
                    if (string.IsNullOrEmpty(text) || !AppConfigLoader.GetConfigBoolValue("Test_OwaAllowHeaderOverride", false))
                    {
                        text = "B387FD19C8C4416694EB79909BED70B5";
                    }
                    userContextKey = UserContextKey.Create(text, logonUniqueKey, explicitLogonUser);
                    ExTraceGlobals.UserContextCallTracer.TraceDebug <UserContextKey>(0L, "Cookie not found but this is explicit logon. Generated Key: {0}", userContextKey);
                }
            }
            return(userContextKey);
        }
        // Token: 0x06001158 RID: 4440 RVA: 0x000426A0 File Offset: 0x000408A0
        internal override void Initialize()
        {
            Stopwatch stopwatch = Stopwatch.StartNew();

            ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtml loading begin");
            IntPtr value = NativeMethods.LoadLibrary(Path.GetFullPath(Path.Combine(ExchangeSetupContext.BinPath, "SafeHtmlNativeWrapper.dll")));

            if (value == IntPtr.Zero)
            {
                ExTraceGlobals.ConfigurationManagerTracer.TraceError(0L, "OwaApplication.Initialize: Failed to load SafeHtmlNativeWrapper.");
                Global.SafeHtmlLoaded = false;
            }
            else
            {
                ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtmlNativeWrapper loaded successfully.");
                Global.SafeHtmlLoaded = true;
            }
            SafeHtml.Initialize(ExchangeSetupContext.BinPath + Path.DirectorySeparatorChar);
            ExTraceGlobals.ConfigurationManagerTracer.TraceDebug(0L, "OwaApplication.Initialize: SafeHtml loading finished");
            Global.InitializeSettingsFromWebConfig();
            int workerThreads;
            int num;

            ThreadPool.GetMinThreads(out workerThreads, out num);
            int configIntValue = AppConfigLoader.GetConfigIntValue("ThreadPoolMinIOCPThreads", 0, int.MaxValue, 3 * Environment.ProcessorCount);

            ThreadPool.SetMinThreads(workerThreads, configIntValue);
            OwaApplication.InitializeApplicationCaches();
            RequestDetailsLogger.ApplicationType = LoggerApplicationType.Owa;
            OwaClientLogger.Initialize();
            OwaClientTraceLogger.Initialize();
            OwaServerLogger.Initialize();
            OwaServerTraceLogger.Initialize();
            SettingOverrideSync.Instance.Start(true);
            LoggerSettings.MaxAppendableColumnLength   = null;
            LoggerSettings.ErrorMessageLengthThreshold = null;
            Global.ResponseShapeResolver = new OwaResponseShapeResolver();
            Global.EwsClientMailboxSessionCloningHandler = new EwsClientMailboxSessionCloningHandler(UserContextManager.GetClonedMailboxSession);
            Global.DefaultMapiClientType             = "Client=OWA";
            MailboxSession.DefaultFoldersToForceInit = OwaApplication.foldersToForceInitialize;
            UserContextManager.Initialize();
            if (Globals.OwaIsNoRecycleEnabled)
            {
                OwaVersionId.InitializeOwaVersionReadingTimer();
            }
            KillBitTimer.Singleton.Start();
            KillbitWatcher.TryWatch(new KillbitWatcher.ReadKillBitFromFileCallback(KillBitHelper.ReadKillBitFromFile));
            OwaServerLogger.AppendToLog(new OwaAppStartLogEvent((double)stopwatch.ElapsedMilliseconds));
        }
Пример #12
0
        private static void CheckAndAddHostNameChangedCookie(RequestContext requestContext, HttpRequest request)
        {
            UserContext userContext = UserContextManager.GetMailboxContext(requestContext.HttpContext, null, true) as UserContext;
            bool        flag        = userContext != null && userContext.FeaturesManager != null && userContext.FeaturesManager.ServerSettings.OwaHostNameSwitch.Enabled;

            if (flag && requestContext.RequestType == OwaRequestType.Form15 && !RequestDispatcher.HostNameController.IsUserAgentExcludedFromHostNameSwitchFlight(request))
            {
                Uri    requestUrlEvenIfProxied = request.GetRequestUrlEvenIfProxied();
                string text = null;
                if (RequestDispatcher.HostNameController.IsDeprecatedHostName(requestUrlEvenIfProxied.Host, out text))
                {
                    RequestDispatcher.HostNameController.AddHostSwitchFlightEnabledCookie(requestContext.HttpContext.Response);
                }
            }
        }
Пример #13
0
 private static DispatchStepResult DispatchIfLastPendingGet(RequestContext requestContext)
 {
     if (requestContext.RequestType != OwaRequestType.Oeh)
     {
         return(DispatchStepResult.Continue);
     }
     ExTraceGlobals.CoreCallTracer.TraceDebug(0L, "[RequestDispatcher::DispatchIfLastPendingGet] entry.");
     requestContext.UserContext = UserContextManager.GetUserContext(requestContext.HttpContext, false);
     if (OwaEventHandlerBase.ShouldIgnoreRequest(requestContext, requestContext.UserContext))
     {
         requestContext.HttpStatusCode = HttpStatusCode.BadRequest;
         return(DispatchStepResult.EndResponse);
     }
     return(DispatchStepResult.Continue);
 }
        // Token: 0x0600012D RID: 301 RVA: 0x00005100 File Offset: 0x00003300
        internal static string TryGetMailboxIdentityName()
        {
            UserContext userContext = UserContextManager.GetUserContext(HttpContext.Current, CallContext.Current.EffectiveCaller, true);

            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            string result = string.Empty;

            if (userContext.MailboxIdentity != null)
            {
                result = userContext.MailboxIdentity.SafeGetRenderableName();
            }
            return(result);
        }
Пример #15
0
        internal static IMailboxContext GetMailboxContext(HttpContext httpContext, AuthZClientInfo effectiveCaller = null, bool create = true)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException("httpContext");
            }
            ClientSecurityContext overrideClientSecurityContext = (effectiveCaller == null) ? null : effectiveCaller.ClientSecurityContext;
            UserContextCookie     userContextCookie;
            UserContextKey        userContextKey = UserContextManager.GetUserContextKey(httpContext, overrideClientSecurityContext, out userContextCookie);

            if (!create)
            {
                return(UserContextManager.GetMailboxContextFromCache(userContextKey));
            }
            return(UserContextManager.AcquireUserContext(httpContext, effectiveCaller, userContextKey, userContextCookie));
        }
Пример #16
0
        internal static UserContext GetUserContext(HttpContext httpContext, AuthZClientInfo effectiveCaller = null, bool create = true)
        {
            IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(httpContext, effectiveCaller, create);

            if (mailboxContext == null)
            {
                return(null);
            }
            UserContext userContext = mailboxContext as UserContext;

            if (userContext == null)
            {
                throw new OwaInvalidOperationException("Invalid user context returned. It was expected to be a full user context.");
            }
            return(userContext);
        }
Пример #17
0
        // Token: 0x06001B1D RID: 6941 RVA: 0x00066D8C File Offset: 0x00064F8C
        private static UserContext GetUserContext()
        {
            Stopwatch   stopwatch = Stopwatch.StartNew();
            UserContext userContext;

            try
            {
                userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);
            }
            finally
            {
                stopwatch.Stop();
                OwaApplication.GetRequestDetailsLogger.Set(InstantMessageSignIn.LogMetadata.GetUserContext, stopwatch.ElapsedMilliseconds);
            }
            return(userContext);
        }
        // Token: 0x06001B22 RID: 6946 RVA: 0x00066F5C File Offset: 0x0006515C
        protected InstantMessageOperationError SignOut()
        {
            UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);

            if (!userContext.IsInstantMessageEnabled)
            {
                return(InstantMessageOperationError.NotEnabled);
            }
            if (userContext.InstantMessageManager == null)
            {
                return(InstantMessageOperationError.NotConfigured);
            }
            userContext.InstantMessageManager.SignOut();
            InstantMessageUtilities.SetSignedOutFlag(base.MailboxIdentityMailboxSession, true);
            return(InstantMessageOperationError.Success);
        }
Пример #19
0
        protected override string InternalExecute()
        {
            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
            CancellationToken       token       = cancellationTokenSource.Token;
            UserContext             userContext = UserContextManager.GetUserContext(base.CallContext.HttpContext, base.CallContext.EffectiveCaller, true);

            if (this.cancellationId != null && userContext.CancelAttachmentManager.OnCreateAttachment(this.cancellationId, cancellationTokenSource))
            {
                return(null);
            }
            AttachmentDataProvider provider = userContext.AttachmentDataProviderManager.GetProvider(base.CallContext, this.attachmentDataProviderId);
            Guid operationId = Guid.NewGuid();

            CreateAttachmentFromAttachmentDataProvider.DownloadAndAttachFile(operationId, provider, userContext, this.location, this.dataProviderItemId, this.draftEmailId.Id, this.subscriptionId, base.IdConverter, this.channelId, this.dataProviderParentItemId, this.providerEndpointUrl, token, this.cancellationId);
            return(operationId.ToString());
        }
Пример #20
0
        public void DisposePendingNotificationClientRequest()
        {
            IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(HttpContext.Current, null, false);
            HttpResponse    response       = HttpContext.Current.Response;
            object          parameter      = base.GetParameter("Fn");
            bool            flag           = false;

            if (parameter != null)
            {
                flag = (bool)parameter;
            }
            bool   flag2 = false;
            string text  = (string)base.GetParameter("cid");

            text = this.ProcessChannelIdOnRequestAndGenerateIfNeeded(text, flag);
            if (mailboxContext != null && text != null)
            {
                PendingRequestChannel pendingGetChannel = mailboxContext.PendingRequestManager.GetPendingGetChannel(text);
                if (pendingGetChannel != null)
                {
                    flag2 = pendingGetChannel.HandleFinishRequestFromClient();
                    if (flag)
                    {
                        ExTraceGlobals.NotificationsCallTracer.TraceDebug <string>((long)this.GetHashCode(), "[PendingRequestEventHandler::DisposePendingNotificationClientRequest] userContext.PendingRequestManager.RemovePendingGetChannel. ChannelId: {0}", text);
                        mailboxContext.PendingRequestManager.RemovePendingGetChannel(text);
                    }
                }
                else
                {
                    mailboxContext.PendingRequestManager.AddPendingGetChannel(text);
                }
            }
            response.AppendHeader("X-OWA-EventResult", "0");
            response.Write("{");
            if (text != null)
            {
                response.Write("cid:\"");
                response.Write(text);
                response.Write("\",");
            }
            response.Write("syncFnshRq:");
            response.Write(flag2 ? "1}" : "0}");
            HttpUtilities.MakePageNoCacheNoStore(response);
            response.ContentType = HttpUtilities.GetContentTypeString(base.ResponseContentType);
        }
Пример #21
0
        // Token: 0x06001BC7 RID: 7111 RVA: 0x0006AEE4 File Offset: 0x000690E4
        protected override bool InternalExecute()
        {
            CultureInfo cultureInfo;

            try
            {
                cultureInfo = new CultureInfo(this.newUserLocale);
            }
            catch (CultureNotFoundException ex)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string, string>(0L, "{0} is not a valid culture. Exception Message-{1}", this.newUserLocale, ex.Message);
                return(false);
            }
            if (!SetUserLocale.IsSupportedCulture(cultureInfo))
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(0L, "SetUserLocale::IsSupportedCulture- {0} is not a supported culture.", this.newUserLocale);
                return(false);
            }
            UserContext       userContext       = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);
            ExchangePrincipal exchangePrincipal = userContext.ExchangePrincipal;
            PreferredCultures preferredCultures = new PreferredCultures(exchangePrincipal.PreferredCultures);

            preferredCultures.AddSupportedCulture(cultureInfo, new Predicate <CultureInfo>(SetUserLocale.IsSupportedCulture));
            this.SaveCultures(exchangePrincipal.ObjectId, userContext.MailboxSession.GetADRecipientSession(false, ConsistencyMode.FullyConsistent), preferredCultures);
            userContext.ExchangePrincipal = exchangePrincipal.WithPreferredCultures(preferredCultures);
            UserConfigurationPropertyDefinition propertyDefinition  = UserOptionPropertySchema.Instance.GetPropertyDefinition(UserConfigurationPropertyId.DateFormat);
            UserConfigurationPropertyDefinition propertyDefinition2 = UserOptionPropertySchema.Instance.GetPropertyDefinition(UserConfigurationPropertyId.TimeFormat);

            new UserOptionsType
            {
                DateFormat = MailboxRegionalConfiguration.GetDefaultDateFormat(cultureInfo),
                TimeFormat = MailboxRegionalConfiguration.GetDefaultTimeFormat(cultureInfo)
            }.Commit(base.CallContext, new UserConfigurationPropertyDefinition[]
            {
                propertyDefinition,
                propertyDefinition2
            });
            if (this.localizeFolderNames && !this.LocalizeFolders(cultureInfo))
            {
                return(false);
            }
            CallContext.Current.HttpContext.Response.Cookies.Add(new HttpCookie("mkt", cultureInfo.Name));
            CallContext.Current.HttpContext.Response.Cookies.Add(new HttpCookie("UpdatedUserSettings", 32.ToString()));
            return(true);
        }
        // Token: 0x0600105B RID: 4187 RVA: 0x0003EDAC File Offset: 0x0003CFAC
        private void NoActiveSubscription(object sender, EventArgs e)
        {
            ISubscriptionInfo subscriptionInfo = sender as ISubscriptionInfo;

            if (subscriptionInfo != null)
            {
                this.RemoveSubscriptions(subscriptionInfo);
                UserContextKey userContextKey;
                if (this.TryParseUserContextKey(subscriptionInfo.ContextKey, out userContextKey))
                {
                    UserContext userContext = UserContextManager.GetMailboxContextFromCache(userContextKey) as UserContext;
                    if (userContext != null && userContext.IsGroupUserContext)
                    {
                        userContext.RetireMailboxSessionForGroupMailbox();
                    }
                }
            }
        }
Пример #23
0
        // Token: 0x060018EA RID: 6378 RVA: 0x00056554 File Offset: 0x00054754
        private static bool GetActiveViewsConvergenceFlightEnabled(RequestDetailsLogger logger)
        {
            UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);

            if (userContext == null)
            {
                logger.Set(GetLinkPreviewMetadata.UserContextNull, 1);
                logger.Set(GetLinkPreviewMetadata.ActiveViewConvergenceEnabled, 0);
                return(false);
            }
            if (!userContext.FeaturesManager.ClientServerSettings.ActiveViewConvergence.Enabled)
            {
                logger.Set(GetLinkPreviewMetadata.ActiveViewConvergenceEnabled, 0);
                return(false);
            }
            logger.Set(GetLinkPreviewMetadata.ActiveViewConvergenceEnabled, 1);
            return(true);
        }
Пример #24
0
        // Token: 0x0600168A RID: 5770 RVA: 0x000533A4 File Offset: 0x000515A4
        internal override bool UseHttpHandlerFactory(HttpContext httpContext)
        {
            if (OwaServiceHttpHandlerFactory.FlightEnableOverride.Member)
            {
                return(true);
            }
            if (Globals.IsAnonymousCalendarApp)
            {
                return(false);
            }
            if (EsoRequest.IsEsoRequest(httpContext.Request))
            {
                return(false);
            }
            UserContext userContext = UserContextManager.GetMailboxContext(httpContext, null, true) as UserContext;

            return(userContext != null && userContext.FeaturesManager.ServerSettings.OwaHttpHandler.Enabled);
        }
        // Token: 0x06001BD4 RID: 7124 RVA: 0x0006B82C File Offset: 0x00069A2C
        protected override SubscriptionResponseData[] InternalExecute()
        {
            ExTraceGlobals.NotificationsCallTracer.TraceDebug(0L, "[SubscribeToNotificationBase.InternalExecute] Acquiring the UserContext.");
            Stopwatch       stopwatch      = Stopwatch.StartNew();
            IMailboxContext mailboxContext = UserContextManager.GetMailboxContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, false);

            if (mailboxContext.NotificationManager == null)
            {
                throw new OwaInvalidOperationException("UserContext.MapiNotificationManager is null");
            }
            base.CallContext.ProtocolLog.Set(SubscribeToNotificationMetadata.UserContextLatency, stopwatch.ElapsedMilliseconds);
            base.CallContext.ProtocolLog.Set(SubscribeToNotificationMetadata.SubscriptionCount, this.subscriptionData.Length);
            if (this.request.Header.TimeZoneContext != null)
            {
                base.CallContext.ProtocolLog.Set(SubscribeToNotificationMetadata.RequestTimeZone, this.request.Header.TimeZoneContext.TimeZoneDefinition.ExTimeZone.DisplayName);
            }
            return(this.InternalSubscribe(mailboxContext).ToArray());
        }
Пример #26
0
        protected override string InternalExecute()
        {
            Item   item  = null;
            Item   item2 = null;
            string result;

            try
            {
                MailboxSession mailboxIdentityMailboxSession = base.MailboxIdentityMailboxSession;
                item  = Item.Bind(mailboxIdentityMailboxSession, this.ndrMessageId, ItemBindOption.None);
                item2 = ((ReportMessage)item).CreateSendAgain(this.draftFolderId);
                if (this.IrmDecryptIfRestricted(item2, UserContextManager.GetUserContext(base.CallContext.HttpContext)))
                {
                    ((RightsManagedMessageItem)item2).PrepareAcquiredLicensesBeforeSave();
                }
                StoreId storeId = null;
                if (item2 is MessageItem)
                {
                    item2.Save(SaveMode.NoConflictResolutionForceSave);
                    item2.Load();
                    storeId = item2.Id;
                }
                result = StoreId.StoreIdToEwsId(base.CallContext.AccessingPrincipal.MailboxInfo.MailboxGuid, storeId);
            }
            catch (Exception ex)
            {
                OwaServerTraceLogger.AppendToLog(new WacAttachmentLogEvent("Exception generating CreateResendDraft", ex));
                result = string.Empty;
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
                if (item2 != null)
                {
                    item2.Dispose();
                    item2 = null;
                }
            }
            return(result);
        }
            // Token: 0x06001AFF RID: 6911 RVA: 0x0006673C File Offset: 0x0006493C
            private void UploadAttachment(IAttachment attachment, IItem draftItem, out IAttachment newAttachment, out AttachmentId newAttachmentId)
            {
                IStreamAttachment streamAttachment = attachment as IStreamAttachment;

                if (streamAttachment == null)
                {
                    throw new InvalidOperationException("UploadAttachment requires a stream attachment, but was given a " + attachment.GetType().Name);
                }
                UploadItemAsyncResult uploadItemAsyncResult;

                using (Stream contentStream = streamAttachment.GetContentStream())
                {
                    byte[] array = new byte[contentStream.Length];
                    while (contentStream.Position != contentStream.Length)
                    {
                        int count = (int)Math.Min(4000L, contentStream.Length - contentStream.Position);
                        contentStream.Read(array, (int)contentStream.Position, count);
                    }
                    CancellationToken cancellationToken = default(CancellationToken);
                    uploadItemAsyncResult = this.provider.UploadItemSync(array, attachment.FileName, cancellationToken);
                }
                if (uploadItemAsyncResult.ResultCode != AttachmentResultCode.Success)
                {
                    throw new GetWacAttachmentInfo.AttachmentUploadException(uploadItemAsyncResult.ResultCode.ToString());
                }
                UserContext userContext = UserContextManager.GetUserContext(CallContext.Current.HttpContext, CallContext.Current.EffectiveCaller, true);

                this.ResultAttachmentWebServiceUrl = uploadItemAsyncResult.Item.ProviderEndpointUrl;
                this.ResultAttachmentProviderType  = uploadItemAsyncResult.Item.ProviderType.ToString();
                this.ResultAttachmentContentUrl    = this.provider.GetItemAbsoulteUrl(userContext, uploadItemAsyncResult.Item.Location, uploadItemAsyncResult.Item.ProviderEndpointUrl, null, null);
                this.ResultAttachmentExtension     = attachment.FileExtension;
                IReferenceAttachment referenceAttachment = (IReferenceAttachment)this.factory.CreateAttachment(draftItem, AttachmentType.Reference);

                newAttachment   = referenceAttachment;
                newAttachmentId = newAttachment.Id;
                referenceAttachment.AttachLongPathName  = this.ResultAttachmentContentUrl;
                referenceAttachment.ProviderEndpointUrl = this.ResultAttachmentWebServiceUrl;
                referenceAttachment.ProviderType        = this.ResultAttachmentProviderType;
                referenceAttachment.FileName            = attachment.FileName;
                newAttachment.IsInline = false;
                newAttachment.Save();
                draftItem.Save(SaveMode.NoConflictResolutionForceSave);
            }
        // Token: 0x06001056 RID: 4182 RVA: 0x0003EA58 File Offset: 0x0003CC58
        public virtual void CleanUpChannel(string channelId)
        {
            ArgumentValidator.ThrowIfNullOrWhiteSpace("channelId", channelId);
            List <string> list = new List <string>();

            if (this.contextKeySubscriptionsLock.LockWriterElastic(3000))
            {
                try
                {
                    foreach (ISubscriptionInfo subscriptionInfo in this.contextKeySubscriptions.Values.ToArray <ISubscriptionInfo>())
                    {
                        if (subscriptionInfo.CleanUpChannel(channelId))
                        {
                            list.Add(subscriptionInfo.ContextKey);
                        }
                    }
                    goto IL_9D;
                }
                finally
                {
                    this.contextKeySubscriptionsLock.ReleaseWriterLock();
                }
                goto IL_71;
IL_9D:
                foreach (string contextKey in list)
                {
                    UserContextKey userContextKey;
                    if (this.TryParseUserContextKey(contextKey, out userContextKey))
                    {
                        IMailboxContext mailboxContextFromCache = UserContextManager.GetMailboxContextFromCache(userContextKey);
                        if (mailboxContextFromCache != null)
                        {
                            mailboxContextFromCache.NotificationManager.ReleaseSubscriptionsForChannelId(channelId);
                        }
                    }
                }
                return;
            }
IL_71:
            ExTraceGlobals.NotificationsCallTracer.TraceError((long)this.GetHashCode(), "[RemoteNotificationManager::CleanUpChannel] mailboxSubscriptionsLock timed");
            throw new OwaLockTimeoutException(string.Format("Could not acquire WriterLock on mailboxSubscriptions", new object[0]));
        }
Пример #29
0
        protected override ThemeSelectionInfoType InternalExecute()
        {
            ISet <string> set         = new HashSet <string>();
            UserContext   userContext = UserContextManager.GetUserContext(HttpContext.Current);
            IEnumerable <ThemeStyleResource> userMouseThemedResources = this.GetUserMouseThemedResources(userContext);

            foreach (ThemeStyleResource themeStyleResource in userMouseThemedResources)
            {
                string item = Globals.FormatURIForCDN(themeStyleResource.StyleDirectory) + themeStyleResource.ResourceName;
                set.Add(item);
            }
            string currentOwaVersion = userContext.CurrentOwaVersion;

            return(new ThemeSelectionInfoType
            {
                Themes = ThemeManagerFactory.GetInstance(currentOwaVersion).Themes,
                CssPaths = set.Distinct <string>().ToArray <string>(),
                ThemePath = ResourcePathBuilderUtilities.GetThemeResourcesRelativeFolderPath(ResourcePathBuilderUtilities.GetResourcesRelativeFolderPath(currentOwaVersion))
            });
        }
Пример #30
0
        protected override CreateAttachmentResponse InternalExecute()
        {
            UserContext userContext = UserContextManager.GetUserContext(base.CallContext.HttpContext, base.CallContext.EffectiveCaller, true);
            CreateAttachmentResponse createAttachmentResponse;

            if (this.request.CancellationId != null && userContext.CancelAttachmentManager.OnCreateAttachment(this.request.CancellationId, null))
            {
                createAttachmentResponse = CreateAttachmentHelper.BuildCreateAttachmentResponseForCancelled();
            }
            else
            {
                createAttachmentResponse = CreateAttachmentFromLocalFile.CreateAttachment(this.request);
                if (this.request.CancellationId != null)
                {
                    AttachmentIdType attachmentIdFromCreateAttachmentResponse = CreateAttachmentHelper.GetAttachmentIdFromCreateAttachmentResponse(createAttachmentResponse);
                    userContext.CancelAttachmentManager.CreateAttachmentCompleted(this.request.CancellationId, attachmentIdFromCreateAttachmentResponse);
                }
            }
            return(createAttachmentResponse);
        }