internal static string GetFlightInfoForLog()
        {
            string result;

            try
            {
                bool flag;
                VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser(out flag);
                Dictionary <string, bool>    allEacRelatedFeatures  = EacFlightUtility.GetAllEacRelatedFeatures(snapshotForCurrentUser);
                string[] flights = snapshotForCurrentUser.Flights;
                KeyValuePair <string, string>[] constraints = snapshotForCurrentUser.Constraints;
                result = string.Format("Features:{0},  Flights:[{1}],  Constraints:{2}, IsGlobalSnapshot: {3}", new object[]
                {
                    allEacRelatedFeatures.ToLogString <string, bool>(),
                    (flights == null) ? "" : string.Join(",", flights),
                    constraints.ToLogString <string, string>(),
                    flag.ToString()
                });
            }
            catch (Exception)
            {
                result = "Feature status not available, Flight APIs is in Invalid Status";
            }
            return(result);
        }
Exemple #2
0
        protected void RenderGeneralInformation()
        {
            base.Response.Write("<div class='diagBlock'>");
            LocalSession localSession = LocalSession.Current;
            ExchangeRunspaceConfiguration rbacConfiguration = localSession.RbacConfiguration;
            bool flag = localSession.IsInRole("Mailbox+MailboxFullAccess");

            this.Write("Logon user:"******"{0} [{1}]", localSession.Name, rbacConfiguration.ExecutingUserPrimarySmtpAddress));
            this.Write("User-Agent:", HttpContext.Current.Request.UserAgent);
            this.Write("SKU:", Util.IsDataCenter ? "DataCenter" : "On-Premise");
            if (flag)
            {
                this.Write("Mailbox server version:", localSession.Context.MailboxServerVersion);
            }
            else
            {
                this.Write("Mailbox account:", "None mailbox account.");
            }
            this.Write("Current server version:", Util.ApplicationVersion);
            this.Write("Request URL:", HttpContext.Current.GetRequestUrl().ToString());
            this.Write("Display language:", CultureInfo.CurrentCulture.IetfLanguageTag);
            if (flag)
            {
                this.Write("User time zone:", (localSession.UserTimeZone != null) ? localSession.UserTimeZone.DisplayName : "Not set.");
            }
            this.Write("RBAC roles:", this.GetRoles(localSession));
            this.Write("Features:", FlightProvider.Instance.GetAllEnabledFeatures().ToLogString <string>());
            VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();

            this.Write("Flights:", snapshotForCurrentUser.Flights.ToLogString <string>());
            base.Response.Write("</div>");
        }
        public string GetRewriteUrl(string url)
        {
            string text = null;

            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            url = url.Trim().Replace('\\', '/');
            if (EacFlightProvider.eacRewriteToSectionMap.ContainsKey(url))
            {
                VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();
                IUrlMapping @object = snapshotForCurrentUser.Eac.GetObject <IUrlMapping>(EacFlightProvider.eacRewriteToSectionMap[url]);
                text = @object.RemapTo;
                if (text != null)
                {
                    text = text.Trim();
                }
                if (text == string.Empty)
                {
                    text = null;
                }
            }
            return(text);
        }
        public static bool IsWebRequestAllowed(HttpContext context)
        {
            if (!context.IsAcsOAuthRequest())
            {
                return(true);
            }
            VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();

            return(OAuthHelper.IsWebRequestAllowed(snapshotForCurrentUser, snapshotForCurrentUser.Eac.GetObjectsOfType <IEacWebRequest>(), context.Request));
        }
        public bool IsUrlEnabled(string url)
        {
            bool result = true;

            if (url == null)
            {
                throw new ArgumentNullException("url");
            }
            url = url.Trim().Replace('\\', '/');
            if (EacFlightProvider.eacUrlToSectionMap.ContainsKey(url))
            {
                VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();
                IUrl @object = snapshotForCurrentUser.Eac.GetObject <IUrl>(EacFlightProvider.eacUrlToSectionMap[url]);
                result = @object.Enabled;
            }
            return(result);
        }
Exemple #6
0
 protected override void BuildScriptDescriptor(ScriptComponentDescriptor descriptor)
 {
     base.BuildScriptDescriptor(descriptor);
     descriptor.AddScriptProperty("NavTree", this.NavigationTree.ToJsonString(null));
     descriptor.AddProperty("CloudServer", this.CloudServer, true);
     descriptor.AddProperty("ServerVersion", this.ServerVersion);
     if (this.HasHybridParameter)
     {
         descriptor.AddProperty("DisableHybridSyncCheck", this.DisableHybridSyncCheck);
         descriptor.AddProperty("HybridSyncTimeoutInSeconds", this.HybridSyncTimeoutInSeconds);
     }
     descriptor.AddProperty("CmdletLoggingEnabled", EacFlightUtility.GetSnapshotForCurrentUser().Eac.CmdletLogging.Enabled);
     descriptor.AddProperty("ShowPerfConsole", StringComparer.OrdinalIgnoreCase.Equals("true", WebConfigurationManager.AppSettings["ShowPerformanceConsole"]), true);
     descriptor.AddScriptProperty("RbacData", ClientRbac.GetRbacData().ToJsonString(null));
     descriptor.AddProperty("CloseWindowOnLogout", this.CloseWindowOnLogout, true);
     descriptor.AddProperty("IsLegacyLogOff", this.IsLegacyLogOff, true);
 }
        public Dictionary <string, bool> GetAllFeatures()
        {
            VariantConfigurationSnapshot snapshotForCurrentUser = EacFlightUtility.GetSnapshotForCurrentUser();

            return(EacFlightUtility.GetAllEacRelatedFeatures(snapshotForCurrentUser));
        }
        public override bool IsFeatureEnabled(string eacFeatureName)
        {
            VariantConfigurationSnapshot snapshot = eacFeatureName.StartsWith("Global.") ? EacFlightUtility.EacGlobalSnapshot : EacFlightUtility.GetSnapshotForCurrentUser();

            return(snapshot.GetFeature(eacFeatureName).Enabled);
        }
        public static VariantConfigurationSnapshot GetSnapshotForCurrentUser()
        {
            bool flag;

            return(EacFlightUtility.GetSnapshotForCurrentUser(out flag));
        }
 internal static IFeature GetFeature(this VariantConfigurationSnapshot snapshot, string eacSecion)
 {
     return(EacFlightUtility.GetObjectForEac <IFeature>(snapshot, eacSecion));
 }
Exemple #11
0
        private void AddCustomSubLinks(bool isMockObject)
        {
            NavBarLinkData[] currentWorkloadUserSubLinks = null;
            if (this.showAdminFeature)
            {
                this.navBarPack.FeatureSet = "myorg";
                this.navBarPack.NavBarData.CurrentMainLinkElementID = "ShellAdmin";
                if (this.rbacPrincipal.IsInRole("UserOptions+OrgMgmControlPanel"))
                {
                    currentWorkloadUserSubLinks = new NavBarLinkData[]
                    {
                        MockNavBar.CreateLink("eso_O365L", Strings.EntryOnBehalfOf, null, null)
                    };
                }
            }
            else
            {
                this.navBarPack.FeatureSet = "myself";
                this.navBarPack.NavBarData.CurrentMainLinkElementID = "ShellOutlook";
                if (isMockObject && NavigationUtil.ShouldRenderOwaLink(this.rbacPrincipal, this.showAdminFeature))
                {
                    NavBarLinkData[] workloadLinks = new NavBarLinkData[]
                    {
                        MockNavBar.CreateLink("ShellOutlook", Strings.NavBarMail, EcpUrl.OwaVDir, null)
                    };
                    this.navBarPack.NavBarData.WorkloadLinks = workloadLinks;
                }
            }
            this.navBarPack.NavBarData.CurrentWorkloadUserSubLinks = currentWorkloadUserSubLinks;
            List <NavBarLinkData> list = new List <NavBarLinkData>();
            string flightName          = this.navBarPack.NavBarData.FlightName;

            if (!string.IsNullOrEmpty(flightName) && flightName.Contains("GeminiShellUX"))
            {
                this.navBarPack.HelpParameters          = this.navBarPack.NavBarData.HelpLink.Url;
                this.navBarPack.NavBarData.HelpLink.Id  = (this.showAdminFeature ? "openHelp_O365L" : "openOptionHelp_O365L");
                this.navBarPack.NavBarData.HelpLink.Url = HelpUtil.BuildEhcHref(this.showAdminFeature ? EACHelpId.Default.ToString() : OptionsHelpId.OwaOptionsDefault.ToString());
            }
            else if (this.showAdminFeature)
            {
                list.Add(MockNavBar.CreateLink("openHelp_O365L", Strings.Help, HelpUtil.BuildEhcHref(EACHelpId.Default.ToString()), null));
            }
            else
            {
                list.Add(MockNavBar.CreateLink("openOptionHelp_O365L", Strings.Help, HelpUtil.BuildEhcHref(OptionsHelpId.OwaOptionsDefault.ToString()), null));
            }
            HttpCookie httpCookie = HttpContext.Current.Request.Cookies["msExchEcpFvaHelp"];
            bool       flag       = httpCookie != null && httpCookie.Value != null && httpCookie.Value.StartsWith("0");

            list.Add(MockNavBar.CreateLink("toggleFVA_O365L", flag ? ClientStrings.EnableFVA : ClientStrings.DisableFVA, null, null));
            if (NavBarClientBase.showPerfConsole)
            {
                list.Add(MockNavBar.CreateLink("perfConsole_O365L", Strings.PerformanceConsole, null, null));
            }
            if (this.showAdminFeature && EacFlightUtility.GetSnapshotForCurrentUser().Eac.CmdletLogging.Enabled)
            {
                list.Add(MockNavBar.CreateLink("cmdletLogging_O365L", Strings.CmdLogButtonText, null, null));
            }
            this.navBarPack.NavBarData.CurrentWorkloadHelpSubLinks = list.ToArray();
            if (this.isGallatin && this.navBarPack.NavBarData.FooterICPLink != null)
            {
                if (!string.IsNullOrEmpty(this.navBarPack.NavBarData.FooterICPLink.Text))
                {
                    this.navBarPack.NavBarData.FooterICPLink.Text = this.navBarPack.NavBarData.FooterICPLink.Text.Replace("-10", "-22");
                }
                if (!string.IsNullOrEmpty(this.navBarPack.NavBarData.FooterICPLink.Title))
                {
                    this.navBarPack.NavBarData.FooterICPLink.Title = this.navBarPack.NavBarData.FooterICPLink.Title.Replace("-10", "-22");
                }
            }
        }