mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-09 11:21:04 +08:00
remove cast from dynamic to object for medium trust
This commit is contained in:
@@ -48,8 +48,6 @@
|
||||
<defaultSettings timeout="00:30:00"/>
|
||||
</system.transactions>
|
||||
<system.web>
|
||||
<!--<trust level="Medium" originUrl="" />-->
|
||||
|
||||
<httpRuntime requestValidationMode="2.0" />
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
|
||||
@@ -94,14 +94,13 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin")));
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Pager(pagerShape)
|
||||
.Options(model.Options)
|
||||
.TypeDisplayName(model.TypeDisplayName ?? "");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
private IEnumerable<ContentTypeDefinition> GetCreatableTypes(bool andContainable) {
|
||||
@@ -175,10 +174,9 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
}
|
||||
|
||||
ActionResult CreatableTypeList(int? containerId) {
|
||||
dynamic viewModel = Shape.ViewModel(ContentTypes: GetCreatableTypes(containerId.HasValue), ContainerId: containerId);
|
||||
var viewModel = Shape.ViewModel(ContentTypes: GetCreatableTypes(containerId.HasValue), ContainerId: containerId);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("CreatableTypeList", (object)viewModel);
|
||||
return View("CreatableTypeList", viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Create(string id, int? containerId) {
|
||||
@@ -197,9 +195,8 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
}
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildEditor(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = _contentManager.BuildEditor(contentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -232,11 +229,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
|
||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
||||
|
||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||
var model = _contentManager.UpdateEditor(contentItem, this);
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
conditionallyPublish(contentItem);
|
||||
@@ -260,9 +256,8 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Cannot edit content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildEditor(contentItem);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = _contentManager.BuildEditor(contentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@@ -307,11 +302,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
previousRoute = contentItem.As<IAliasAspect>().Path;
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||
var model = _contentManager.UpdateEditor(contentItem, this);
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View("Edit", (object)model);
|
||||
return View("Edit", model);
|
||||
}
|
||||
|
||||
conditionallyPublish(contentItem);
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
return View((object)model);
|
||||
var model = _contentManager.BuildDisplay(contentItem);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
// /Contents/Item/Preview/72
|
||||
@@ -56,8 +56,8 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
}
|
||||
|
||||
dynamic model = _contentManager.BuildDisplay(contentItem);
|
||||
return View((object)model);
|
||||
var model = _contentManager.BuildDisplay(contentItem);
|
||||
return View(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,10 +167,9 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
// filter the content items for this specific menu
|
||||
menuPart.MenuPosition = Position.GetNext(_navigationManager.BuildMenu(menu));
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(menuPart);
|
||||
var model = Services.ContentManager.BuildEditor(menuPart);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Logger.Error(T("Creating menu item failed: {0}", exception.Message).Text);
|
||||
@@ -204,8 +203,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been added.", menuPart.TypeDefinition.DisplayName));
|
||||
|
||||
@@ -52,8 +52,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
model = Services.ContentManager.BuildEditor(site);
|
||||
}
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
@@ -62,7 +61,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var site = _siteService.GetSiteSettings();
|
||||
dynamic model = Services.ContentManager.UpdateEditor(site, this, groupInfoId);
|
||||
var model = Services.ContentManager.UpdateEditor(site, this, groupInfoId);
|
||||
|
||||
GroupInfo groupInfo = null;
|
||||
|
||||
@@ -83,8 +82,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
Services.TransactionManager.Cancel();
|
||||
model.GroupInfo = groupInfo;
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Settings updated"));
|
||||
|
||||
@@ -54,9 +54,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blog);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(blog);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -67,12 +66,11 @@ namespace Orchard.Blogs.Controllers {
|
||||
var blog = Services.ContentManager.New<BlogPart>("Blog");
|
||||
|
||||
_contentManager.Create(blog, VersionOptions.Draft);
|
||||
dynamic model = _contentManager.UpdateEditor(blog, this);
|
||||
var model = _contentManager.UpdateEditor(blog, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
_contentManager.Publish(blog.ContentItem);
|
||||
@@ -88,9 +86,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blog);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(blog);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@@ -121,11 +118,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (blog == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.UpdateEditor(blog, this);
|
||||
var model = Services.ContentManager.UpdateEditor(blog, this);
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
_contentManager.Publish(blog);
|
||||
@@ -159,10 +155,9 @@ namespace Orchard.Blogs.Controllers {
|
||||
return blog;
|
||||
}));
|
||||
|
||||
dynamic viewModel = Services.New.ViewModel()
|
||||
var viewModel = Services.New.ViewModel()
|
||||
.ContentItems(list);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Item(int blogId, PagerParameters pagerParameters) {
|
||||
@@ -175,7 +170,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var blogPosts = _blogPostService.Get(blogPart, pager.GetStartIndex(), pager.PageSize, VersionOptions.Latest).ToArray();
|
||||
var blogPostsShapes = blogPosts.Select(bp => _contentManager.BuildDisplay(bp, "SummaryAdmin")).ToArray();
|
||||
|
||||
dynamic blog = Services.ContentManager.BuildDisplay(blogPart, "DetailAdmin");
|
||||
var blog = Services.ContentManager.BuildDisplay(blogPart, "DetailAdmin");
|
||||
|
||||
var list = Shape.List();
|
||||
list.AddRange(blogPostsShapes);
|
||||
@@ -184,8 +179,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var totalItemCount = _blogPostService.PostCount(blogPart, VersionOptions.Latest);
|
||||
blog.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after");
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)blog);
|
||||
return View(blog);
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
|
||||
@@ -52,11 +52,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(blogs);
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Item(int blogId, PagerParameters pagerParameters) {
|
||||
|
||||
@@ -47,10 +47,9 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, blog, T("Not allowed to create blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(blogPost);
|
||||
var model = Services.ContentManager.BuildEditor(blogPost);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -85,8 +84,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
if (publish) {
|
||||
@@ -114,9 +112,8 @@ namespace Orchard.Blogs.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, post, T("Couldn't edit blog post")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(post);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(post);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@@ -163,8 +160,7 @@ namespace Orchard.Blogs.Controllers {
|
||||
var model = Services.ContentManager.UpdateEditor(blogPost, this);
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
conditionallyPublish(blogPost.ContentItem);
|
||||
|
||||
@@ -58,13 +58,12 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
_feedManager.Register(blogPart);
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Blog(blogPart)
|
||||
.ArchiveData(archive);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -67,14 +67,13 @@ namespace Orchard.CustomForms.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateSubmitPermission(customForm.ContentType), contentItem, T("Cannot create content")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
dynamic model = _contentManager.BuildEditor(contentItem);
|
||||
var model = _contentManager.BuildEditor(contentItem);
|
||||
|
||||
model
|
||||
.ContentItem(form)
|
||||
.ReturnUrl(Url.RouteUrl(_contentManager.GetItemMetadata(form).DisplayRouteValues));
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -122,7 +121,7 @@ namespace Orchard.CustomForms.Controllers {
|
||||
|
||||
_contentManager.Create(contentItem, VersionOptions.Draft);
|
||||
|
||||
dynamic model = _contentManager.UpdateEditor(contentItem, this);
|
||||
var model = _contentManager.UpdateEditor(contentItem, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
_transactionManager.Cancel();
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Orchard.Lists.Controllers {
|
||||
else if (!string.IsNullOrEmpty(model.FilterByContentType))
|
||||
containerItemContentDisplayName = _contentDefinitionManager.GetTypeDefinition(model.FilterByContentType).DisplayName;
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Pager(pagerShape)
|
||||
.ContainerId(model.ContainerId)
|
||||
@@ -106,8 +106,7 @@ namespace Orchard.Lists.Controllers {
|
||||
.Where(item => item != container)
|
||||
.OrderBy(item => item.As<CommonPart>().VersionPublishedUtc));
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
private IContentQuery<ContentItem> GetListContentItemQuery(int containerId, string contentType, ContentsOrder orderBy) {
|
||||
@@ -233,7 +232,7 @@ namespace Orchard.Lists.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(pageOfContentItems.Select(ci => _contentManager.BuildDisplay(ci, "SummaryAdmin")));
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Pager(pagerShape)
|
||||
.SourceContainerId(model.SourceContainerId)
|
||||
@@ -245,8 +244,7 @@ namespace Orchard.Lists.Controllers {
|
||||
.Select(part => part.ContentItem)
|
||||
.OrderBy(item => item.As<CommonPart>().VersionPublishedUtc));
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Choose")]
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace Orchard.Projections.Controllers {
|
||||
var list = Shape.List();
|
||||
list.AddRange(contentShapes);
|
||||
|
||||
return View((object)list);
|
||||
return View(list);
|
||||
}
|
||||
|
||||
bool IUpdateModel.TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) {
|
||||
|
||||
@@ -66,13 +66,12 @@ namespace Orchard.Search.Controllers {
|
||||
|
||||
var pagerShape = Services.New.Pager(pager).TotalItemCount(searchHits.TotalItemCount);
|
||||
|
||||
dynamic viewModel = Services.New.ViewModel()
|
||||
var viewModel = Services.New.ViewModel()
|
||||
.ContentItems(list)
|
||||
.Pager(pagerShape)
|
||||
.SearchText(searchText);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -154,7 +154,7 @@ namespace Orchard.Taxonomies.Controllers {
|
||||
term.Container = parentTerm == null ? taxonomy : (IContent)parentTerm;
|
||||
|
||||
var model = Services.ContentManager.BuildEditor(term);
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -171,7 +171,7 @@ namespace Orchard.Taxonomies.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
_taxonomyService.ProcessPath(term);
|
||||
@@ -191,7 +191,7 @@ namespace Orchard.Taxonomies.Controllers {
|
||||
return HttpNotFound();
|
||||
|
||||
var model = Services.ContentManager.BuildEditor(term);
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@@ -209,7 +209,7 @@ namespace Orchard.Taxonomies.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.ContentManager.Publish(contentItem);
|
||||
|
||||
@@ -157,11 +157,10 @@ namespace Orchard.Users.Controllers {
|
||||
var user = Services.ContentManager.New<IUser>("User");
|
||||
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Create", Model: new UserCreateViewModel(), Prefix: null);
|
||||
editor.Metadata.Position = "2";
|
||||
dynamic model = Services.ContentManager.BuildEditor(user);
|
||||
var model = Services.ContentManager.BuildEditor(user);
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -193,7 +192,7 @@ namespace Orchard.Users.Controllers {
|
||||
null, null, true));
|
||||
}
|
||||
|
||||
dynamic model = Services.ContentManager.UpdateEditor(user, this);
|
||||
var model = Services.ContentManager.UpdateEditor(user, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
@@ -202,8 +201,7 @@ namespace Orchard.Users.Controllers {
|
||||
editor.Metadata.Position = "2";
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("User created"));
|
||||
@@ -217,11 +215,10 @@ namespace Orchard.Users.Controllers {
|
||||
var user = Services.ContentManager.Get<UserPart>(id);
|
||||
var editor = Shape.EditorTemplate(TemplateName: "Parts/User.Edit", Model: new UserEditViewModel {User = user}, Prefix: null);
|
||||
editor.Metadata.Position = "2";
|
||||
dynamic model = Services.ContentManager.BuildEditor(user);
|
||||
var model = Services.ContentManager.BuildEditor(user);
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
@@ -232,7 +229,7 @@ namespace Orchard.Users.Controllers {
|
||||
var user = Services.ContentManager.Get<UserPart>(id, VersionOptions.DraftRequired);
|
||||
string previousName = user.UserName;
|
||||
|
||||
dynamic model = Services.ContentManager.UpdateEditor(user, this);
|
||||
var model = Services.ContentManager.UpdateEditor(user, this);
|
||||
|
||||
var editModel = new UserEditViewModel {User = user};
|
||||
if (TryUpdateModel(editModel)) {
|
||||
@@ -260,8 +257,7 @@ namespace Orchard.Users.Controllers {
|
||||
editor.Metadata.Position = "2";
|
||||
model.Content.Add(editor);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.ContentManager.Publish(user.ContentItem);
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
string zonePreviewImagePath = string.Format("{0}/{1}/ThemeZonePreview.png", currentTheme.Location, currentTheme.Id);
|
||||
string zonePreviewImage = _virtualPathProvider.FileExists(zonePreviewImagePath) ? zonePreviewImagePath : null;
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.CurrentTheme(currentTheme)
|
||||
.CurrentLayer(currentLayer)
|
||||
.Layers(layers)
|
||||
@@ -87,8 +87,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
.OrphanWidgets(_widgetsService.GetOrphanedWidgets())
|
||||
.ZonePreviewImage(zonePreviewImage);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
@@ -136,14 +135,13 @@ namespace Orchard.Widgets.Controllers {
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
||||
dynamic viewModel = Shape.ViewModel()
|
||||
var viewModel = Shape.ViewModel()
|
||||
.CurrentLayer(currentLayer)
|
||||
.Zone(zone)
|
||||
.WidgetTypes(_widgetsService.GetWidgetTypes())
|
||||
.ReturnUrl(returnUrl);
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult AddWidget(int layerId, string widgetType, string zone, string returnUrl) {
|
||||
@@ -158,9 +156,9 @@ namespace Orchard.Widgets.Controllers {
|
||||
widgetPart.Position = widgetPosition.ToString(CultureInfo.InvariantCulture);
|
||||
widgetPart.Zone = zone;
|
||||
widgetPart.LayerPart = _widgetsService.GetLayer(layerId);
|
||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
|
||||
return View(model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Logger.Error(T("Creating widget failed: {0}", exception.Message).Text);
|
||||
@@ -190,8 +188,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
}
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been added.", widgetPart.TypeDefinition.DisplayName));
|
||||
@@ -207,7 +204,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
if (layerPart == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||
var model = Services.ContentManager.BuildEditor(layerPart);
|
||||
|
||||
// only messing with the hints if they're given
|
||||
if (!string.IsNullOrWhiteSpace(name))
|
||||
@@ -217,8 +214,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
if (!string.IsNullOrWhiteSpace(layerRule))
|
||||
model.LayerRule = layerRule;
|
||||
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("AddLayer")]
|
||||
@@ -234,8 +230,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been created.", layerPart.TypeDefinition.DisplayName));
|
||||
@@ -250,9 +245,8 @@ namespace Orchard.Widgets.Controllers {
|
||||
if (layerPart == null)
|
||||
return HttpNotFound();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(layerPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(layerPart);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("EditLayer")]
|
||||
@@ -269,8 +263,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been saved.", layerPart.TypeDefinition.DisplayName));
|
||||
@@ -306,9 +299,8 @@ namespace Orchard.Widgets.Controllers {
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
try {
|
||||
dynamic model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
var model = Services.ContentManager.BuildEditor(widgetPart);
|
||||
return View(model);
|
||||
}
|
||||
catch (Exception exception) {
|
||||
Logger.Error(T("Editing widget failed: {0}", exception.Message).Text);
|
||||
@@ -337,8 +329,7 @@ namespace Orchard.Widgets.Controllers {
|
||||
widgetPart.LayerPart = _widgetsService.GetLayer(layerId);
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
// Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation.
|
||||
return View((object)model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("Your {0} has been saved.", widgetPart.TypeDefinition.DisplayName));
|
||||
|
||||
@@ -51,7 +51,6 @@
|
||||
|
||||
-->
|
||||
<system.web>
|
||||
<!--<trust level="Medium" originUrl="" />-->
|
||||
<!-- Accept file uploads up to 64 Mb -->
|
||||
<httpRuntime targetFramework="4.5" requestValidationMode="2.0" maxRequestLength="65536"/>
|
||||
<!--
|
||||
|
||||
@@ -10,10 +10,10 @@ namespace Orchard.Environment.Extensions.Compilers {
|
||||
|
||||
_codeCompilerType = GetDefaultCompilerTypeForLanguage("C#");
|
||||
|
||||
// NOTE: This code could be used to define a compilation flag with the current Orchar version
|
||||
// NOTE: This code could be used to define a compilation flag with the current Orchard version
|
||||
// but it's not compatible with Medium Trust
|
||||
// var orchardVersion = new AssemblyName(typeof(IDependency).Assembly.FullName).Version;
|
||||
// _codeCompilerType.CompilerParameters.CompilerOptions += string.Format("/define:ORCHARD_{0}_{1}", orchardVersion.Major, orchardVersion.Minor);
|
||||
var orchardVersion = new AssemblyName(typeof(IDependency).Assembly.FullName).Version;
|
||||
_codeCompilerType.CompilerParameters.CompilerOptions += string.Format("/define:ORCHARD_{0}_{1}", orchardVersion.Major, orchardVersion.Minor);
|
||||
}
|
||||
|
||||
public IOrchardHostContainer HostContainer { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user