当前位置: 首页>>代码示例>>C#>>正文


C# User.GetPermissions方法代码示例

本文整理汇总了C#中umbraco.BusinessLogic.User.GetPermissions方法的典型用法代码示例。如果您正苦于以下问题:C# User.GetPermissions方法的具体用法?C# User.GetPermissions怎么用?C# User.GetPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.BusinessLogic.User的用法示例。


在下文中一共展示了User.GetPermissions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ValidateUserNodeTreePermissions

        /// <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;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:17,代码来源:WebSecurity.cs

示例2: Page_Load

        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();
        }
开发者ID:kgiszewski,项目名称:SimpleForms,代码行数:39,代码来源:editform.aspx.cs


注:本文中的umbraco.BusinessLogic.User.GetPermissions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。