Ejemplo n.º 1
0
 public IEnumerable <ContentTypeDefinition> GetHierarchyTypes()
 {
     return(_contentDefinitionManager.ListTypeDefinitions()
            .Where(ctd => ctd.Parts.Any(pa => pa
                                        .PartDefinition.Name.Equals(TerritoryHierarchyPart.PartName, StringComparison.InvariantCultureIgnoreCase)) &&
                   _authorizer.Authorize(TerritoriesPermissions.GetHierarchyPermission(ctd))));
 }
Ejemplo n.º 2
0
 public void Adjust(CheckAccessContext context)
 {
     if (!context.Granted &&
         context.Content.Is <TerritoryHierarchyPart>())
     {
         var typeDefinition = context.Content.ContentItem.TypeDefinition;
         //replace permission if there is one specific for the content type
         if (typeDefinition.Parts.Any(ctpd => ctpd.PartDefinition.Name == TerritoryHierarchyPart.PartName) &&
             context.Permission == TerritoriesPermissions.ManageTerritoryHierarchies)
         {
             context.Adjusted   = true;
             context.Permission = TerritoriesPermissions.GetHierarchyPermission(typeDefinition);
         }
     }
 }