GetAllowedChildTypes() public méthode

public GetAllowedChildTypes ( ) : IEnumerable
Résultat IEnumerable
Exemple #1
0
        public static IEnumerable<Node> GetNewItemNodes(GenericContent content) 
        {
            if (content == null)
                throw new ArgumentNullException("content");

            return GetNewItemNodes(content, content.GetAllowedChildTypes().ToArray());
        }
Exemple #2
0
        /// <summary>
        /// Checks if a content of the given ContentType is allowed under a given parent content
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="contentTypeName"></param>
        /// <returns></returns>
        public static bool CheckAllowedContentType(GenericContent parent, string contentTypeName)
        {
            // check allowed content types
            // true: allowed list is empty, but current user is administrator (if allowed types list is empty: only administrator should upload any type.)
            // true: if this type is allowed 
            var cTypes = parent.GetAllowedChildTypes().ToList();
            if ((cTypes.Count == 0 && PortalContext.Current.ArbitraryContentTypeCreationAllowed) || (cTypes.Any(ct => ct.Name == contentTypeName)))
                return true;

            return false;
        }