public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery context) { // get page of context var parent = context.Parent; while (!parent.IsPage) { if (parent.Parent == null) { return(AllowedDefinitionResult.Deny); } parent = parent.Parent; } var parentType = parent.GetType(); if (ChildType.IsAssignableFrom(context.ChildDefinition.ItemType)) { if (Attribute.Types != null && !Attribute.Types.Any(t => t.IsAssignableFrom(parentType))) { //Trace.TraceInformation(context.ChildDefinition.ItemType.Name + " denied on " + parentType.Name); return(AllowedDefinitionResult.Deny); } //if (this.Attribute.TemplateKeys != null && !this.Attribute.TemplateKeys.Contains(context.ParentDefinition.TemplateKey)) // return AllowedDefinitionResult.Deny; } return(AllowedDefinitionResult.DontCare); }
public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery context) { if (parentType.IsAssignableFrom(context.ParentDefinition.ItemType) && IsAssignable(context.ChildDefinition.ItemType)) { return(AllowedDefinitionResult.Allow); } else { return((option == IntegrityMappingOption.AddToExising) ? AllowedDefinitionResult.DontCare : AllowedDefinitionResult.Deny); } }
public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery context) { if (IsAssignable(context.ChildDefinition.ItemType)) { if (TemplateNames == null || TemplateNames.Contains(context.ChildDefinition.TemplateKey)) { return(AllowedDefinitionResult.DontCare); } } return(AllowedDefinitionResult.Deny); }
public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery context) { if (ChildType.IsAssignableFrom(context.ChildDefinition.ItemType)) { if (this.Attribute.Types != null && !this.Attribute.Types.Any(t => t.IsAssignableFrom(context.ParentDefinition.ItemType))) { return(AllowedDefinitionResult.Deny); } if (this.Attribute.TemplateKeys != null && !this.Attribute.TemplateKeys.Contains(context.ParentDefinition.TemplateKey)) { return(AllowedDefinitionResult.Deny); } } return(AllowedDefinitionResult.DontCare); }
public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery query) { if (query.ParentDefinition == null) { return(AllowedDefinitionResult.DontCare); } if (query.Parent == null) { return(AllowedDefinitionResult.DontCare); } var type = ComparableType ?? query.ChildDefinition.ItemType; int childrenOfTypeCount = query.Parent.Children.Count(i => type.IsAssignableFrom(i.GetContentType())); if (childrenOfTypeCount >= MaximumCount) { return(AllowedDefinitionResult.Deny); } return(AllowedDefinitionResult.DontCare); }
public AllowedDefinitionResult IsAllowed(AllowedDefinitionQuery context) { return(IsAssignable(context.ChildDefinition.ItemType) ? AllowedDefinitionResult.Allow : AllowedDefinitionResult.DontCare); }