當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。