本文整理汇总了C#中IAclService.Authorize方法的典型用法代码示例。如果您正苦于以下问题:C# IAclService.Authorize方法的具体用法?C# IAclService.Authorize怎么用?C# IAclService.Authorize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAclService
的用法示例。
在下文中一共展示了IAclService.Authorize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetCategoryBreadCrumb
/// <summary>
/// Get category breadcrumb
/// </summary>
/// <param name="category">Category</param>
/// <param name="categoryService">Category service</param>
/// <param name="aclService">ACL service</param>
/// <param name="storeMappingService">Store mapping service</param>
/// <param name="showHidden">A value indicating whether to load hidden records</param>
/// <returns>Category breadcrumb </returns>
public static IList<Category> GetCategoryBreadCrumb(this Category category,
ICategoryService categoryService,
IAclService aclService,
IStoreMappingService storeMappingService,
bool showHidden = false)
{
if (category == null)
throw new ArgumentNullException("category");
var result = new List<Category>();
//used to prevent circular references
var alreadyProcessedCategoryIds = new List<int>();
while (category != null && //not null
!category.Deleted && //not deleted
(showHidden || category.Published) && //published
(showHidden || aclService.Authorize(category)) && //ACL
(showHidden || storeMappingService.Authorize(category)) && //Store mapping
!alreadyProcessedCategoryIds.Contains(category.Id)) //prevent circular references
{
result.Add(category);
alreadyProcessedCategoryIds.Add(category.Id);
category = categoryService.GetCategoryById(category.ParentCategoryId);
}
result.Reverse();
return result;
}