protected static string GetUrl(object roleId, object actionId) { string str = null; if (RoleProvider.IsBuiltIn((Guid)roleId)) { str = Resources.RolesControl_BuiltInRoleUrl; } else { Micajah.Common.Bll.Action action = ActionProvider.PagesAndControls.FindByActionId((Guid)actionId); str = ((action == null) ? string.Empty : CustomUrlProvider.CreateApplicationRelativeUrl(action.AbsoluteNavigateUrl)); } return(str); }
// Just validates the access rights of current user to specified URL. internal static void ValidateRedirectUrl(ref string redirectUrl) { if (!string.IsNullOrEmpty(redirectUrl)) { if (string.Compare(CustomUrlProvider.CreateApplicationRelativeUrl(redirectUrl), "/", StringComparison.OrdinalIgnoreCase) == 0) { redirectUrl = null; } else { Guid actionId = Guid.Empty; object obj = Support.ConvertStringToType(Support.ExtractQueryStringParameterValue(redirectUrl, "pageid"), typeof(Guid)); if (obj != null) { actionId = (Guid)obj; } Micajah.Common.Bll.Action action = ActionProvider.FindAction(actionId, CustomUrlProvider.CreateApplicationAbsoluteUrl(redirectUrl)); if (action != null) { if (action.AuthenticationRequired) { UserContext user = UserContext.Current; if (user != null && user.OrganizationId != Guid.Empty) { if (!user.ActionIdList.Contains(action.ActionId)) { redirectUrl = null; } } } } else { redirectUrl = null; } } } }
/// <summary> /// Returns the URL of the action to navigate. /// </summary> /// <param name="action">The action to get URL of.</param> /// <returns>The System.String that represents the URL of the action to navigate.</returns> public virtual string GetNavigateUrl(Action action) { if (action == null) { return(null); } if ((action.ActionId == ActionProvider.ConfigurationPageActionId) || (action.ActionId == ActionProvider.ConfigurationGlobalNavigationLinkActionId)) { if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == MasterPageTheme.Modern) { return(CustomUrlProvider.CreateApplicationRelativeUrl(ResourceProvider.AccountSettingsVirtualPath)); } } else if (action.ActionId == ActionProvider.LoginGlobalNavigationLinkActionId) { UserContext user = UserContext.Current; if ((user != null) && (user.OrganizationId == Guid.Empty)) { return(CustomUrlProvider.CreateApplicationAbsoluteUrl(ResourceProvider.ActiveOrganizationPageVirtualPath)); } } else if (action.ActionId == ActionProvider.MyAccountMenuGlobalNavigationLinkActionId) { if (FrameworkConfiguration.Current.WebApplication.MasterPage.Theme == MasterPageTheme.Modern) { return(string.Empty); } } else if (action.ActionId == ActionProvider.StartGlobalNavigationLinkActionId) { Action page = ActionProvider.FindAction(ActionProvider.StartPageActionId); return(page.AbsoluteNavigateUrl); } return(action.NavigateUrl); }
/// <summary> /// Finds the action by specified navigate URL. /// </summary> /// <param name="navigateUrl">The navigate URL of the action.</param> /// <param name="isAbsoluteNavigateUrl">The flag specifying that the navigate URL is an application absolute URL.</param> /// <param name="fullMatch">Whether the comparision mode is full match.</param> /// <returns>The Micajah.Common.Bll.Action object if the action is found; otherwise a null reference.</returns> public Action FindByNavigateUrlPathAndQuery(string navigateUrl, bool isAbsoluteNavigateUrl, bool fullMatch) { lock (((ICollection)this).SyncRoot) { return(this.Find( delegate(Action action) { if (!(string.IsNullOrEmpty(action.NavigateUrl) || string.IsNullOrEmpty(navigateUrl) || action.IsDetailMenuPage)) { string[] p1 = (isAbsoluteNavigateUrl ? action.AbsoluteNavigateUrl : CustomUrlProvider.CreateApplicationRelativeUrl(action.NavigateUrl)).Split('?'); string[] p2 = navigateUrl.Split('?'); if (((string.Compare(p1[0], p2[0], StringComparison.OrdinalIgnoreCase) == 0)) && (p1.Length > 1) && (p2.Length > 1)) { NameValueCollection c1 = HttpUtility.ParseQueryString(p1[1]); NameValueCollection c2 = HttpUtility.ParseQueryString(p2[1]); int equalsCount = 0; int totalCount = 0; foreach (string k1 in c1.AllKeys) { if (c2[k1] != null) { totalCount++; if ((string.Compare(c1[k1], c2[k1], StringComparison.OrdinalIgnoreCase) == 0) || ((c1[k1] == string.Empty) && (c2[k1] != null))) { equalsCount++; } } } return ((((!fullMatch) && (totalCount > 0)) || (fullMatch && (totalCount == c1.AllKeys.Length))) && (equalsCount == totalCount)); } } return false; })); } }
/// <summary> /// Finds the action by specified navigate URL. /// </summary> /// <param name="navigateUrl">The navigate URL of the action.</param> /// <param name="isAbsoluteNavigateUrl">The flag specifying that the navigate URL is an application absolute URL.</param> /// <returns>The Micajah.Common.Bll.Action object if the action is found; otherwise a null reference.</returns> public Action FindByNavigateUrl(string navigateUrl, bool isAbsoluteNavigateUrl) { lock (((ICollection)this).SyncRoot) { return(this.Find( delegate(Action action) { return (string.Compare((isAbsoluteNavigateUrl ? action.AbsoluteNavigateUrl : CustomUrlProvider.CreateApplicationRelativeUrl(action.NavigateUrl)), navigateUrl, StringComparison.OrdinalIgnoreCase) == 0); })); } }