Filter creatable types based on permissions

This commit is contained in:
fassetar
2014-01-30 22:45:09 -05:00
committed by Sebastien Ros
parent 88fd2f2273
commit 7366af95ee

View File

@@ -105,7 +105,10 @@ namespace Orchard.Core.Contents.Controllers {
}
private IEnumerable<ContentTypeDefinition> GetCreatableTypes(bool andContainable) {
return _contentDefinitionManager.ListTypeDefinitions().Where(ctd => ctd.Settings.GetModel<ContentTypeSettings>().Creatable && (!andContainable || ctd.Parts.Any(p => p.PartDefinition.Name == "ContainablePart")));
return _contentDefinitionManager.ListTypeDefinitions().Where(ctd =>
Services.Authorizer.Authorize(Permissions.EditContent, _contentManager.New(ctd.Name)) &&
ctd.Settings.GetModel<ContentTypeSettings>().Creatable &&
(!andContainable || ctd.Parts.Any(p => p.PartDefinition.Name == "ContainablePart")));
}
[HttpPost, ActionName("List")]