本文整理匯總了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();
}