Esempio n. 1
0
        public static string GenerateAbsoluteLogInUrl()
        {
            var logInUrl = string.Empty;

            switch (FirmaWebConfiguration.AuthenticationType)
            {
            case AuthenticationType.KeystoneAuth:
                logInUrl = SitkaRoute <AccountController> .BuildAbsoluteUrlHttpsFromExpression(c => c.LogOn());

                break;

            case AuthenticationType.LocalAuth:
                logInUrl = SitkaRoute <LocalAuthenticationController> .BuildAbsoluteUrlHttpsFromExpression(c => c.LocalAuthLogon());

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(logInUrl);
        }
Esempio n. 2
0
        public static RedirectResult RedirectToActionStatic <T>(SitkaRoute <T> route) where T : Controller
        {
            var redirectToActionStatic = new RedirectResult(route.BuildUrlFromExpression());

            return(redirectToActionStatic);
        }
Esempio n. 3
0
 protected ActionResult RedirectToActionWithError <T>(SitkaRoute <T> route, string error) where T : Controller
 {
     SetErrorForDisplay(error);
     return(RedirectToActionStatic(route));
 }
Esempio n. 4
0
        protected RedirectResult RedirectToActionWithPermanentRedirect <T>(SitkaRoute <T> route) where T : Controller
        {
            var redirectToActionStatic = new RedirectResult(route.BuildUrlFromExpression(), true);

            return(redirectToActionStatic);
        }
Esempio n. 5
0
 protected RedirectResult RedirectToAction <T>(SitkaRoute <T> route) where T : Controller
 {
     return(RedirectToActionStatic(route));
 }
Esempio n. 6
0
        public static string SecuredAction <T>(Person person, Expression <Action <T> > routeExpression, string grantedFormat, string deniedFormat) where T : Controller
        {
            var body = SitkaRoute <T> .GetRouteExpressionBody(routeExpression);

            var firmaFeatureLookupAttribute = body.Method.GetCustomAttributes(typeof(FirmaBaseFeature), true).Cast <FirmaBaseFeature>().SingleOrDefault();

            Check.RequireNotNull(firmaFeatureLookupAttribute, string.Format("Could not find feature for {0}", SitkaRoute <T> .BuildUrlFromExpression(routeExpression)));
            return(firmaFeatureLookupAttribute.HasPermissionByPerson(person) ? String.Format("<a href=\"{0}\">{1}</a>", SitkaRoute <T> .BuildUrlFromExpression(routeExpression), grantedFormat) : deniedFormat);
        }
Esempio n. 7
0
 public static void AddTechnicalAssistanceParametersMenuItem(LtInfoMenuItem manageMenu, FirmaSession currentFirmaSession, string menuGroupName)
 {
     if (UsesTechnicalAssistanceParameters() && new FirmaAdminFeature().HasPermission(currentFirmaSession).HasPermission)
     {
         manageMenu.AddMenuItem(LtInfoMenuItem.MakeItem("Technical Assistance Parameters",
                                                        ModalDialogFormHelper.ModalDialogFormLink("Technical Assistance Parameters",
                                                                                                  SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(c => c.TechnicalAssistanceParameters()),
                                                                                                  "Technical Assistance Parameters", 800,
                                                                                                  "Save", "Cancel", new List <string>(), null, null).ToString(), menuGroupName));
     }
 }