Beispiel #1
0
        /// <summary>
        /// Validates the user node tree permissions.
        /// </summary>
        /// <param name="umbracoUser"></param>
        /// <param name="path">The path.</param>
        /// <param name="action">The action.</param>
        /// <returns></returns>
        internal bool ValidateUserNodeTreePermissions(User umbracoUser, string path, string action)
        {
            var permissions = umbracoUser.GetPermissions(path);
            if (permissions.IndexOf(action, StringComparison.Ordinal) > -1 && (path.Contains("-20") || ("," + path + ",").Contains("," + umbracoUser.StartNodeId + ",")))
                return true;

            var user = umbracoUser;
            LogHelper.Info<WebSecurity>("User {0} has insufficient permissions in UmbracoEnsuredPage: '{1}', '{2}', '{3}'", () => user.Name, () => path, () => permissions, () => action);
            return false;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //set the user and check access
            SimpleFormsCore.Authorize();
            currentUser = umbraco.BusinessLogic.User.GetCurrent();
            userCanPublish = currentUser.GetPermissions(formDocument.Path).Contains('R');

            //handle any postbacks
            if (Page.IsPostBack)
            {
                HandlePostback();
            }

            //get the form schema
            formSchema = new FormSchema(template.Alias);

            h2 = new HtmlGenericControl("h2");
            h2.InnerHtml = "<a class='formFields' href='#'>" + t("Form Fields") + "</a>";

            if (currentUser.IsAdmin())
            {
                settings.Controls.Add(h2);
                BuildFieldTable();
            }

            formIDBox.Text = formSchema.ID.ToString();
            formName.Text = formSchema.Name;

            BuildDocumentButtons();

            //update the url
            string niceurl = umbraco.library.NiceUrl(formDocument.Id);
            string url = "<a target='_blank' href='" + niceurl + "'>" + niceurl + "</a>";
            urlTD.InnerHtml = url;

            BuildSubmissionsUI();

            BuildSubmissionsTable();
        }