コード例 #1
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var currentPage = UmbracoContext.Current.PublishedContentRequest.PublishedContent;

            if (!currentPage.DocumentTypeAlias.Equals(DocumentTypeAliasConstants.GroupsMembersPage))
            {
                return;
            }

            var groupId = filterContext.HttpContext.Request.QueryString[GroupIdQueryParameterName];

            if (groupId == null)
            {
                TransferRequestHelper.ToErrorPage(filterContext);

                return;
            }

            if (Guid.TryParse(groupId, out var id))
            {
                var group = GroupService.Get(id);

                if (group == null || group.IsHidden)
                {
                    TransferRequestHelper.ToErrorPage(filterContext);
                }
            }
            else
            {
                TransferRequestHelper.ToErrorPage(filterContext);
            }
        }
コード例 #2
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var groupId      = GetGroupIdFromRequest(filterContext);
            var validGroupId = groupId.Filter(IsValidGroupId);

            if (groupId.IsSome && validGroupId.IsNone)
            {
                TransferRequestHelper.ToErrorPage(filterContext);
            }
        }
コード例 #3
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            Guid?activityId = null;

            if (filterContext.ActionParameters.TryGetValue(ActivityIdParameterName, out var obj))
            {
                activityId = obj as Guid?;
            }

            var activityServices =
                DependencyResolver.Current.GetServices <IIntranetActivityService <IIntranetActivity> >();

            var activity = activityServices.Select(service => service.Get(activityId.GetValueOrDefault()))
                           .FirstOrDefault(a => a != null);

            if (activity == null || activity.IsHidden)
            {
                TransferRequestHelper.ToErrorPage(filterContext);
            }
        }
コード例 #4
0
        public static MvcHtmlString RenderControl(HtmlHelper htmlHelper, dynamic control)
        {
            try
            {
                var config = control.editor?.config;
                if (config == null || config.action == null || config.controller == null)
                {
                    string editor = EditorPath(control);
                    return(htmlHelper.Partial(editor, (object)control));
                }

                string action     = config.action;
                string controller = config.controller;

                if (config.includeUmbracoValues != null && (bool)config.includeUmbracoValues)
                {
                    var controllerParams = new RouteValueDictionary(ParseUmbracoValues(control));
                    return(htmlHelper.Action(action, controller, controllerParams));
                }

                if (config.includeParams != null && (bool)config.includeParams)
                {
                    var controllerParams = new RouteValueDictionary(ParseParams(config));
                    return(htmlHelper.Action(action, controller, controllerParams));
                }

                return(htmlHelper.Action(action, controller));
            }
            catch (Exception ex)
            {
                if (HttpContext.Current.IsDebuggingEnabled)
                {
                    return(MvcHtmlString.Create($"<pre>{ex}</pre>"));
                }

                TransferRequestHelper.ToErrorPage();
            }

            return(MvcHtmlString.Empty);
        }