本文整理汇总了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;
}
示例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();
}