예제 #1
0
        private void BuildNameDropDown()
        {
            RbacPrincipal   rbacPrincipal   = RbacPrincipal.Current;
            DropDownCommand dropDownCommand = this.nameDropDown.DropDownCommand;

            dropDownCommand.Name = "UserName";
            dropDownCommand.Text = rbacPrincipal.Name;
            if (this.hasHelpdesk)
            {
                dropDownCommand.Commands.Add(new Command
                {
                    Name          = "Helpdesk",
                    Text          = Strings.EntryOnBehalfOf,
                    OnClientClick = "CrossPremise.NavTo('helpdesk');"
                });
            }
            if (rbacPrincipal.IsInRole("MailboxFullAccess") && !rbacPrincipal.IsInRole("DelegatedAdmin") && !rbacPrincipal.IsInRole("ByoidAdmin"))
            {
                if (dropDownCommand.Commands.Count > 0)
                {
                    dropDownCommand.Commands.Add(new SeparatorCommand());
                }
                dropDownCommand.Commands.Add(new Command
                {
                    Name          = "SignOff",
                    Text          = Strings.SignOff,
                    OnClientClick = "CrossPremise.NavTo('dualLogout');"
                });
            }
        }
예제 #2
0
        protected void RenderAlertBarBegin()
        {
            RbacPrincipal rbacPrincipal = RbacPrincipal.Current;
            string        text          = null;
            string        text2         = null;

            if (!rbacPrincipal.IsInRole("MailboxFullAccess"))
            {
                string logonUser    = HttpUtility.HtmlEncode((rbacPrincipal.IsInRole("Enterprise") && rbacPrincipal.RbacConfiguration.SecurityAccessToken != null && rbacPrincipal.RbacConfiguration.SecurityAccessToken.LogonName != null && rbacPrincipal.RbacConfiguration.Impersonated) ? rbacPrincipal.RbacConfiguration.SecurityAccessToken.LogonName : rbacPrincipal.RbacConfiguration.LogonUserDisplayName);
                string accessedUser = HttpUtility.HtmlEncode(rbacPrincipal.RbacConfiguration.ExecutingUserDisplayName);
                text  = Strings.OnbehalfOfAlert("<strong>", logonUser, "</strong>", accessedUser);
                text2 = Strings.OnbehalfOfAlert(string.Empty, logonUser, string.Empty, accessedUser);
            }
            else if (rbacPrincipal.IsInRole("DelegatedAdmin") || rbacPrincipal.IsInRole("ByoidAdmin"))
            {
                string targetTenant = HttpContext.Current.GetTargetTenant();
                text  = Strings.ManageOtherTenantAlert("<strong>", targetTenant, "</strong>");
                text2 = Strings.ManageOtherTenantAlert(string.Empty, targetTenant, string.Empty);
            }
            if (text != null)
            {
                this.renderAlertBar = true;
                string cssClass = NavigationSprite.GetCssClass(NavigationSprite.SpriteId.EsoBarEdge);
                base.Response.Output.Write("<div id=\"EsoBar\" class=\"{0}\"><img id=\"EsoBarIcon\" class=\"{1}\" src=\"{6}\" alt=\"\" /><div id=\"EsoBarMsg\" title=\"{2}\">{3}</div><img id=\"EsoBarLeftEdge\" class=\"{4}\" src=\"{6}\" alt=\"\"/><img id=\"EsoBarRightEdge\" class=\"{5}\" src=\"{6}\" alt=\"\"></div></div><div id=\"EsoNavWrap\">", new object[]
                {
                    HorizontalSprite.GetCssClass(HorizontalSprite.SpriteId.EsoBar),
                    CommonSprite.GetCssClass(CommonSprite.SpriteId.Information),
                    text2,
                    text,
                    cssClass,
                    cssClass,
                    Util.GetSpriteImageSrc(this)
                });
            }
        }
예제 #3
0
        internal static JsonDictionary <bool> GetRbacData()
        {
            Dictionary <string, bool> dictionary    = new Dictionary <string, bool>(ClientRbac.rbacRoles.Count + ClientRbac.HybridEcpFeatures.Count, StringComparer.OrdinalIgnoreCase);
            RbacPrincipal             rbacPrincipal = RbacPrincipal.Current;

            foreach (string text in ClientRbac.rbacRoles)
            {
                dictionary.Add(text, rbacPrincipal.IsInRole(text));
            }
            foreach (EcpFeature ecpFeature in ClientRbac.HybridEcpFeatures)
            {
                string name = ecpFeature.GetName();
                dictionary.Add(name, rbacPrincipal.IsInRole(name));
            }
            return(new JsonDictionary <bool>(dictionary));
        }
예제 #4
0
        private Uri GetECPExternalUrl()
        {
            Uri           result        = null;
            RbacPrincipal rbacPrincipal = RbacPrincipal.Current;

            if (rbacPrincipal.IsInRole("Mailbox"))
            {
                ExchangePrincipal exchangePrincipal = ExchangePrincipal.FromDirectoryObjectId((IRecipientSession)((RecipientObjectResolver)RecipientObjectResolver.Instance).CreateAdSession(), rbacPrincipal.ExecutingUserId, RemotingOptions.LocalConnectionsOnly);
                try
                {
                    result = FrontEndLocator.GetFrontEndEcpUrl(exchangePrincipal);
                }
                catch (ServerNotFoundException)
                {
                }
            }
            return(result);
        }
예제 #5
0
        private string GetRoles(RbacPrincipal rbacPrincipal)
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = true;

            foreach (object obj in Enum.GetValues(typeof(RoleType)))
            {
                RoleType roleType = (RoleType)obj;
                string   text     = roleType.ToString();
                if (rbacPrincipal.IsInRole(text))
                {
                    if (flag)
                    {
                        flag = false;
                    }
                    else
                    {
                        stringBuilder.Append(", ");
                    }
                    stringBuilder.Append(text);
                }
            }
            return(stringBuilder.ToString());
        }
예제 #6
0
        private void UpdateColumns()
        {
            if (!string.IsNullOrEmpty(this.DefaultSprite) || !string.IsNullOrEmpty(this.SpriteProperty))
            {
                this.Columns.Insert(0, new SpriteColumnHeader
                {
                    DefaultSprite         = this.DefaultSprite,
                    Name                  = this.SpriteProperty,
                    AlternateTextProperty = this.SpriteAltTextProperty
                });
            }
            if (this.AllowSorting && this.SortProperty == null)
            {
                foreach (ColumnHeader columnHeader in this.Columns)
                {
                    if (!string.IsNullOrEmpty(columnHeader.SortExpression) && !(columnHeader is SpriteColumnHeader))
                    {
                        this.SortProperty = columnHeader.SortExpression;
                        break;
                    }
                }
            }
            RbacPrincipal rbacPrincipal = RbacPrincipal.Current;

            this.Columns.RemoveAll((ColumnHeader x) => !string.IsNullOrEmpty(x.Role) && !rbacPrincipal.IsInRole(x.Role));
        }
예제 #7
0
 internal static bool ShouldRenderOwaLink(RbacPrincipal rbacPrincipal, bool showAdminFeature)
 {
     return(!showAdminFeature && !NavigationUtil.LaunchedFromOutlook && rbacPrincipal.IsInRole("Mailbox+OWA+MailboxFullAccess"));
 }
예제 #8
0
 internal static bool ShouldRenderLogoutLink(RbacPrincipal rbacPrincipal)
 {
     return(rbacPrincipal.IsInRole("MailboxFullAccess+!DelegatedAdmin+!ByoidAdmin"));
 }