Пример #1
0
        // Token: 0x06000BF7 RID: 3063 RVA: 0x00031E60 File Offset: 0x00030060
        private void WriteAppStatuesToMailbox()
        {
            if (this.appStatuses.Count == 0)
            {
                return;
            }
            GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.ConfigAppStatus: Config app status for {0} extensions.", this.appStatuses.Count);
            Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (KeyValuePair <string, string> keyValuePair in this.appStatuses)
                        {
                            installedExtensionTable.ConfigureAppStatus(keyValuePair.Key, keyValuePair.Value);
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });

            if (ex != null)
            {
                GetUpdates.Tracer.TraceError <Exception>(0L, "GetUpdates.ConfigAppStatus: Config app status failed. Exception: {0}", ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToConfigAppStatus, null, new object[]
                {
                    "ProcessUpdates",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal),
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
            }
        }
Пример #2
0
        protected override IEnumerable <T> InternalFindPaged <T>(QueryFilter filter, ObjectId rootId, bool deepSearch, SortBy sortBy, int pageSize)
        {
            AppId owaExtensionId = rootId as AppId;

            if (sortBy != null)
            {
                throw new NotSupportedException("sortBy");
            }
            if (rootId != null && owaExtensionId == null)
            {
                throw new NotSupportedException("rootId");
            }
            InstalledExtensionTable installedList = null;

            OWAExtensionDataProvider.RunAction(delegate
            {
                installedList = InstalledExtensionTable.CreateInstalledExtensionTable(this.domain, this.isUserScope, null, this.MailboxSession);
            });
            if (owaExtensionId == null || (owaExtensionId.DisplayName == null && owaExtensionId.AppIdValue == null))
            {
                List <ExtensionData> extensions = null;
                OWAExtensionDataProvider.RunAction(delegate
                {
                    extensions             = installedList.GetExtensions(null, false, this.isDebug, out this.rawOrgMasterTableXml);
                    this.rawMasterTableXml = (this.isDebug ? installedList.MasterTableXml.InnerXml : string.Empty);
                });
                foreach (ExtensionData extensionData2 in extensions)
                {
                    yield return((T)((object)this.ConvertStoreObjectToPresentationObject(extensionData2)));
                }
            }
            else if (!string.IsNullOrEmpty(owaExtensionId.AppIdValue))
            {
                ExtensionData extensionData = null;
                OWAExtensionDataProvider.RunAction(delegate
                {
                    installedList.TryGetExtension(owaExtensionId.AppIdValue, out extensionData, this.isDebug, out this.rawOrgMasterTableXml);
                    this.rawMasterTableXml = (this.isDebug ? installedList.MasterTableXml.InnerXml : string.Empty);
                });
                if (extensionData != null)
                {
                    yield return((T)((object)this.ConvertStoreObjectToPresentationObject(extensionData)));
                }
            }
            yield break;
            yield break;
        }
Пример #3
0
        // Token: 0x06000BF5 RID: 3061 RVA: 0x00031C20 File Offset: 0x0002FE20
        internal void InstallExtensionUpdates(List <ExtensionData> updates, UpdateQueryContext queryContext)
        {
            GetUpdates.Tracer.TraceDebug <int>(0L, "GetUpdates.InstallExtensionUpdates: Installing {0} extensions.", updates.Count);
            ExtensionData currentExtensionData = null;
            Exception     ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(queryContext.ExchangePrincipal, queryContext.CultureInfo, queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(queryContext.Domain, queryContext.IsUserScope, queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (ExtensionData currentExtensionData in updates)
                        {
                            currentExtensionData = currentExtensionData;
                            GetUpdates.Tracer.TraceDebug <string>(0L, "GetUpdates.InstallExtensionUpdates: Installing asset {0}", currentExtensionData.MarketplaceAssetID);
                            installedExtensionTable.AddExtension(currentExtensionData, true);
                            currentExtensionData = null;
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });
            string text = (currentExtensionData == null) ? string.Empty : currentExtensionData.MarketplaceAssetID;

            if (ex != null)
            {
                GetUpdates.Tracer.TraceError <string, Exception>(0L, "GetUpdates.InstallExtensionUpdates: Installation failed for extension {0}. Exception: {1}", text, ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateFailed, null, new object[]
                {
                    "UpdateExtension",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal),
                    text,
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
            }
            else
            {
                ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ExtensionUpdateSuccess, null, new object[]
                {
                    "UpdateExtension",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(queryContext.ExchangePrincipal),
                    text
                });
            }
            this.ExecuteNextUpdateQuery();
        }
Пример #4
0
        protected override void InternalSave(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            App owaExtension = instance as App;

            if (owaExtension == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            OWAExtensionDataProvider.RunAction(delegate
            {
                using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.domain, this.isUserScope, null, this.MailboxSession))
                {
                    switch (owaExtension.ObjectState)
                    {
                    case ObjectState.New:
                        if (!owaExtension.IsDownloadOnly)
                        {
                            installedExtensionTable.InstallExtension(owaExtension.GetExtensionDataForInstall(this.adRecipientSession), false);
                        }
                        break;

                    case ObjectState.Changed:
                        if (this.isUserScope)
                        {
                            installedExtensionTable.ConfigureUserExtension(owaExtension.AppId, owaExtension.Enabled);
                        }
                        else
                        {
                            OrgApp orgApp = instance as OrgApp;
                            if (orgApp == null)
                            {
                                throw new NotSupportedException("Save: " + instance.GetType().FullName);
                            }
                            installedExtensionTable.ConfigureOrgExtension(orgApp.AppId, orgApp.Enabled, orgApp.DefaultStateForUser == DefaultStateForUser.AlwaysEnabled, orgApp.DefaultStateForUser == DefaultStateForUser.Enabled, orgApp.ProvidedTo, OrgApp.ConvertPresentationFormatToWireUserList(this.adRecipientSession, orgApp.UserList));
                        }
                        break;
                    }
                }
            });
        }
Пример #5
0
        private void WriteTokensToMailbox()
        {
            if (this.downloadedTokens.Count == 0 && this.appStatuses.Count == 0)
            {
                return;
            }
            GetTokens.Tracer.TraceDebug <int, int>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens for {0} apps, failure error codes for {0} apps.", this.downloadedTokens.Count, this.appStatuses.Count);
            Exception ex = InstalledExtensionTable.RunClientExtensionAction(delegate
            {
                using (MailboxSession mailboxSession = MailboxSession.OpenAsSystemService(this.queryContext.ExchangePrincipal, this.queryContext.CultureInfo, this.queryContext.ClientInfoString))
                {
                    using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.queryContext.Domain, this.queryContext.IsUserScope, this.queryContext.OrgEmptyMasterTableCache, mailboxSession))
                    {
                        foreach (KeyValuePair <string, string> keyValuePair in this.downloadedTokens)
                        {
                            installedExtensionTable.ConfigureEtoken(keyValuePair.Key, keyValuePair.Value, true);
                        }
                        foreach (KeyValuePair <string, string> keyValuePair2 in this.appStatuses)
                        {
                            installedExtensionTable.ConfigureAppStatus(keyValuePair2.Key, keyValuePair2.Value);
                        }
                        installedExtensionTable.SaveXML();
                    }
                }
            });

            if (ex != null)
            {
                GetTokens.Tracer.TraceError <Exception>(0L, "GetTokens.WriteTokensToMailbox: Writing renewed tokens failed. Exception: {0}", ex);
                ExtensionDiagnostics.Logger.LogEvent(ApplicationLogicEventLogConstants.Tuple_FailedToWritebackRenewedTokens, null, new object[]
                {
                    "ProcessTokenRenew",
                    ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal),
                    ExtensionDiagnostics.GetLoggedExceptionString(ex)
                });
                return;
            }
            ExtensionDiagnostics.LogToDatacenterOnly(ApplicationLogicEventLogConstants.Tuple_ProcessTokenRenewCompleted, null, new object[]
            {
                "ProcessTokenRenew",
                ExtensionDiagnostics.GetLoggedMailboxIdentifier(this.queryContext.ExchangePrincipal)
            });
        }
Пример #6
0
        protected override void InternalDelete(ConfigurableObject instance)
        {
            if (instance == null)
            {
                throw new ArgumentNullException("instance");
            }
            App owaExtension = instance as App;

            if (owaExtension == null)
            {
                throw new NotSupportedException("Save: " + instance.GetType().FullName);
            }
            OWAExtensionDataProvider.RunAction(delegate
            {
                using (InstalledExtensionTable installedExtensionTable = InstalledExtensionTable.CreateInstalledExtensionTable(this.domain, this.isUserScope, null, this.MailboxSession))
                {
                    if (this.isUserScope)
                    {
                        if (ExtensionInstallScope.User != owaExtension.Scope)
                        {
                            throw new OwaExtensionOperationException(Strings.ErrorUninstallProvidedExtension(owaExtension.DisplayName));
                        }
                        if (this.TryRemovePerExtensionFai(owaExtension.AppId, owaExtension.AppVersion))
                        {
                            installedExtensionTable.UninstallExtension(owaExtension.AppId);
                        }
                        else
                        {
                            installedExtensionTable.ConfigureUserExtension(owaExtension.AppId, false);
                        }
                    }
                    else
                    {
                        if (ExtensionInstallScope.Default == owaExtension.Scope)
                        {
                            throw new OwaExtensionOperationException(Strings.ErrorUninstallDefaultExtension(owaExtension.DisplayName));
                        }
                        installedExtensionTable.UninstallExtension(owaExtension.AppId);
                    }
                }
            });
        }