mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Merge branch '1.8.x' into 1.x
This commit is contained in:
@@ -106,7 +106,11 @@ namespace Orchard.Comments.Drivers {
|
||||
var currentUser = workContext.CurrentUser;
|
||||
part.UserName = (currentUser != null ? currentUser.UserName : null);
|
||||
|
||||
if (currentUser != null) part.Author = currentUser.UserName;
|
||||
if (currentUser != null)
|
||||
part.Author = currentUser.UserName;
|
||||
else if (string.IsNullOrWhiteSpace(part.Author)) {
|
||||
updater.AddModelError("Comments.Author", T("Name is mandatory"));
|
||||
}
|
||||
|
||||
var moderateComments = workContext.CurrentSite.As<CommentSettingsPart>().ModerateComments;
|
||||
part.Status = moderateComments ? CommentStatus.Pending : CommentStatus.Approved;
|
||||
|
@@ -1,13 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ContentTypeDefinition.Part>" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement.MetaData.Models" %>
|
||||
<fieldset>
|
||||
<h3><%:Model.PartDefinition.Name %></h3>
|
||||
<div class="manage add-to-type">
|
||||
<%--// these inline forms can't be here. should probably have some JavaScript in here to build up the forms and add the "remove" link.
|
||||
// get the antiforgery token from the edit type form and mark up the part in a semantic way so I can get some info from the DOM --%>
|
||||
<% using (Html.BeginFormAntiForgeryPost(Url.Action("RemovePart", new { area = "Contents" }), FormMethod.Post, new {@class = "inline link"})) { %>
|
||||
<%=Html.Hidden("name", Model.PartDefinition.Name, new { id = "" }) %>
|
||||
<button type="submit" title="<%:T("Remove") %>"><%:T("Remove") %></button>
|
||||
<% } %>
|
||||
</div>
|
||||
</fieldset>
|
@@ -81,7 +81,7 @@ namespace Orchard.Modules.Controllers {
|
||||
|
||||
IEnumerable<ModuleEntry> modules = _extensionManager.AvailableExtensions()
|
||||
.Where(extensionDescriptor => DefaultExtensionTypes.IsModule(extensionDescriptor.ExtensionType) &&
|
||||
ModuleIsAllowed(extensionDescriptor) &&
|
||||
|
||||
(string.IsNullOrEmpty(options.SearchText) || extensionDescriptor.Name.ToLowerInvariant().Contains(options.SearchText.ToLowerInvariant())))
|
||||
.OrderBy(extensionDescriptor => extensionDescriptor.Name)
|
||||
.Select(extensionDescriptor => new ModuleEntry { Descriptor = extensionDescriptor });
|
||||
@@ -174,7 +174,7 @@ namespace Orchard.Modules.Controllers {
|
||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
|
||||
IEnumerable<ModuleFeature> features = _featureManager.GetAvailableFeatures()
|
||||
.Where(f => !DefaultExtensionTypes.IsTheme(f.Extension.ExtensionType) && ModuleIsAllowed(f.Extension))
|
||||
.Where(f => !DefaultExtensionTypes.IsTheme(f.Extension.ExtensionType))
|
||||
.Select(f => new ModuleFeature {
|
||||
Descriptor = f,
|
||||
IsEnabled = _shellDescriptor.Features.Any(sf => sf.Name == f.Id),
|
||||
@@ -184,7 +184,10 @@ namespace Orchard.Modules.Controllers {
|
||||
})
|
||||
.ToList();
|
||||
|
||||
return View(new FeaturesViewModel { Features = features });
|
||||
return View(new FeaturesViewModel {
|
||||
Features = features,
|
||||
IsAllowed = ModuleIsAllowed
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Features")]
|
||||
|
@@ -1,10 +1,14 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Modules.Models;
|
||||
|
||||
namespace Orchard.Modules.ViewModels {
|
||||
public class FeaturesViewModel {
|
||||
public IEnumerable<ModuleFeature> Features { get; set; }
|
||||
public FeaturesBulkAction BulkAction { get; set; }
|
||||
public Func<ExtensionDescriptor, bool> IsAllowed { get; set; }
|
||||
}
|
||||
|
||||
public enum FeaturesBulkAction {
|
||||
|
@@ -35,10 +35,14 @@
|
||||
<button type="submit" name="submit.BulkExecute" value="yes">@T("Execute")</button>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<ul class="features summary-view switchable">@{
|
||||
|
||||
<ul class="features summary-view switchable">
|
||||
@{
|
||||
var featureGroups = Model.Features.OrderBy(f => f.Descriptor.Category, new DoghouseComparer("Core")).GroupBy(f => f.Descriptor.Category).ToList();
|
||||
foreach (var featureGroup in featureGroups) {
|
||||
if (!featureGroup.Any(x => Model.IsAllowed(x.Descriptor.Extension))) {
|
||||
continue;
|
||||
}
|
||||
var categoryName = LocalizedString.TextOrDefault(featureGroup.First().Descriptor.Category, T("Uncategorized"));
|
||||
var categoryClassName = string.Format("category {0}", Html.Encode(categoryName.ToString().HtmlClassify()));
|
||||
if (featureGroup == featureGroups.First()) {
|
||||
@@ -48,11 +52,15 @@
|
||||
categoryClassName += " last";
|
||||
}
|
||||
|
||||
<li class="@categoryClassName">
|
||||
<h2>@categoryName</h2>
|
||||
<ul>@{
|
||||
<li class="@categoryClassName">
|
||||
<h2>@categoryName</h2>
|
||||
<ul>
|
||||
@{
|
||||
var features = featureGroup.OrderBy(f => f.Descriptor.Name);
|
||||
foreach (var feature in features) {
|
||||
if (!Model.IsAllowed(feature.Descriptor.Extension)) {
|
||||
continue;
|
||||
}
|
||||
//hmmm...I feel like I've done this before...
|
||||
var featureId = feature.Descriptor.Id.AsFeatureId(n => T(n));
|
||||
var featureName = string.IsNullOrEmpty(feature.Descriptor.Name) ? feature.Descriptor.Id : feature.Descriptor.Name;
|
||||
@@ -74,57 +82,59 @@
|
||||
var missingDependencies = feature.Descriptor.Dependencies
|
||||
.Where(d => !Model.Features.Any(f => f.Descriptor.Id.Equals(d, StringComparison.OrdinalIgnoreCase)));
|
||||
var showDisable = categoryName.ToString() != "Core";
|
||||
var showEnable = !missingDependencies.Any() && feature.Descriptor.Id != "Orchard.Setup";
|
||||
|
||||
var showEnable = Model.IsAllowed(feature.Descriptor.Extension) && !missingDependencies.Any() && feature.Descriptor.Id != "Orchard.Setup";
|
||||
|
||||
<li class="@featureClassName" id="@featureId" title="@T("{0} is {1}", Html.AttributeEncode(featureName), featureState)">
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3>
|
||||
@if ((showEnable && !feature.IsEnabled) || (showDisable && feature.IsEnabled)) {
|
||||
<label>
|
||||
<input type="checkbox" name="featureIds" value="@feature.Descriptor.Id"/>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3>
|
||||
@if ((showEnable && !feature.IsEnabled) || (showDisable && feature.IsEnabled)) {
|
||||
<label>
|
||||
<input type="checkbox" name="featureIds" value="@feature.Descriptor.Id" />
|
||||
@featureName
|
||||
</label>
|
||||
}
|
||||
else {
|
||||
@featureName
|
||||
</label>
|
||||
}
|
||||
else {
|
||||
@featureName
|
||||
}
|
||||
</h3>
|
||||
<p class="description" title="@feature.Descriptor.Description">@feature.Descriptor.Description</p>
|
||||
@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
||||
<div class="dependencies">
|
||||
<h4>@T("Depends on:")</h4>
|
||||
@Html.UnorderedList(dependencies,
|
||||
}
|
||||
</h3>
|
||||
<p class="description" title="@feature.Descriptor.Description">@feature.Descriptor.Description</p>
|
||||
@if (feature.Descriptor.Dependencies != null && feature.Descriptor.Dependencies.Any()) {
|
||||
<div class="dependencies">
|
||||
<h4>@T("Depends on:")</h4>
|
||||
@Html.UnorderedList(dependencies,
|
||||
(s, i) => Html.Link(string.IsNullOrEmpty(s.Descriptor.Name) ? s.Descriptor.Id : s.Descriptor.Name, string.Format("#{0}", s.Descriptor.Id.AsFeatureId(n => T(n)))),
|
||||
"",
|
||||
"dependency",
|
||||
"")
|
||||
</div>}
|
||||
@if (missingDependencies.Any()) {
|
||||
<div class="missingdependencies">
|
||||
<h4>@T("Missing:")</h4>
|
||||
@Html.UnorderedList(missingDependencies, (s, i) => MvcHtmlString.Create(s), "", "missingdependency", "")
|
||||
</div>}
|
||||
</div>
|
||||
<div class="actions">
|
||||
@if (showDisable && feature.IsEnabled) {
|
||||
var dependantsJoined = string.Join(", ", feature.DependentFeatures.Select(f => f.Name));
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Disable" data-feature-force="true" data-feature-dependants="@dependantsJoined">@T("Disable")</a>
|
||||
}
|
||||
</div>}
|
||||
@if (missingDependencies.Any()) {
|
||||
<div class="missingdependencies">
|
||||
<h4>@T("Missing:")</h4>
|
||||
@Html.UnorderedList(missingDependencies, (s, i) => MvcHtmlString.Create(s), "", "missingdependency", "")
|
||||
</div>}
|
||||
</div>
|
||||
<div class="actions">
|
||||
@if (showDisable && feature.IsEnabled) {
|
||||
var dependantsJoined = string.Join(", ", feature.DependentFeatures.Select(f => f.Name));
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Disable" data-feature-force="true" data-feature-dependants="@dependantsJoined">@T("Disable")</a>
|
||||
}
|
||||
|
||||
@if (showEnable && !feature.IsEnabled) {
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Enable" data-feature-force="true">@T("Enable")</a>
|
||||
}
|
||||
@if (showEnable && !feature.IsEnabled) {
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Enable" data-feature-force="true">@T("Enable")</a>
|
||||
}
|
||||
|
||||
@if (feature.NeedsUpdate) {
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Update" data-feature-force="false">@T("Update")</a>
|
||||
}
|
||||
@if (feature.NeedsUpdate) {
|
||||
<a href="#" data-feature-id="@feature.Descriptor.Id" data-feature-action="@FeaturesBulkAction.Update" data-feature-force="false">@T("Update")</a>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>}
|
||||
}
|
||||
</ul>
|
||||
</li>}
|
||||
}</ul>
|
||||
</li>}
|
||||
}</ul>}
|
||||
}
|
||||
</ul>}
|
||||
|
||||
using (Script.Foot()) {
|
||||
<script type="text/javascript">
|
||||
|
@@ -20,6 +20,7 @@ using Orchard.Services;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.Utility.Extensions;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Orchard.OutputCache.Filters {
|
||||
public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter {
|
||||
@@ -37,6 +38,9 @@ namespace Orchard.OutputCache.Filters {
|
||||
private readonly ICacheControlStrategy _cacheControlStrategy;
|
||||
private Stream _previousFilter;
|
||||
|
||||
private static string RefreshKey = "__r";
|
||||
private static long Epoch = new DateTime(2014, DateTimeKind.Utc).Ticks;
|
||||
|
||||
public OutputCacheFilter(
|
||||
ICacheManager cacheManager,
|
||||
IOutputCacheStorageProvider cacheStorageProvider,
|
||||
@@ -151,12 +155,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
);
|
||||
|
||||
// caches the default max age duration to prevent a query to the settings
|
||||
_maxAge = _cacheManager.Get("CacheSettingsPart.MaxAge",
|
||||
context => {
|
||||
context.Monitor(_signals.When(CacheSettingsPart.CacheKey));
|
||||
return _workContext.CurrentSite.As<CacheSettingsPart>().DefaultMaxAge;
|
||||
}
|
||||
);
|
||||
_maxAge = GetMaxAge();
|
||||
|
||||
_varyQueryStringParameters = _cacheManager.Get("CacheSettingsPart.VaryQueryStringParameters",
|
||||
context => {
|
||||
@@ -219,6 +218,11 @@ namespace Orchard.OutputCache.Filters {
|
||||
foreach (var key in queryString.AllKeys) {
|
||||
if (key == null) continue;
|
||||
|
||||
// ignore pages with the RefreshKey
|
||||
if (String.Equals(RefreshKey, key, StringComparison.OrdinalIgnoreCase)) {
|
||||
return;
|
||||
}
|
||||
|
||||
parameters[key] = queryString[key];
|
||||
}
|
||||
|
||||
@@ -448,14 +452,16 @@ namespace Orchard.OutputCache.Filters {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
var redirectResult = filterContext.Result as RedirectResult;
|
||||
|
||||
// status code can't be tested at this point, so test the result type instead
|
||||
if (!filterContext.HttpContext.Request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase)
|
||||
|| !(filterContext.Result is RedirectResult)) {
|
||||
if (redirectResult == null ||
|
||||
!filterContext.HttpContext.Request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Logger.Debug("Redirect on POST");
|
||||
var redirectUrl = ((RedirectResult)(filterContext.Result)).Url ;
|
||||
var redirectUrl = redirectResult.Url ;
|
||||
|
||||
if (!VirtualPathUtility.IsAbsolute(redirectUrl)) {
|
||||
var applicationRoot = new UrlHelper(filterContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
|
||||
@@ -476,7 +482,34 @@ namespace Orchard.OutputCache.Filters {
|
||||
// remove all cached version of the same page
|
||||
_cacheService.RemoveByTag(invariantCacheKey);
|
||||
|
||||
filterContext.Result = new RedirectResult(redirectUrl, ((RedirectResult) filterContext.Result).Permanent);
|
||||
// adding a refresh key so that the redirection doesn't get restored
|
||||
// from a cached version on a proxy
|
||||
// this can happen when using public caching, we want to force the
|
||||
// client to get a fresh copy of the redirectUrl page
|
||||
|
||||
if (GetMaxAge() > 0) {
|
||||
var epIndex = redirectUrl.IndexOf('?');
|
||||
var qs = new NameValueCollection();
|
||||
if (epIndex > 0) {
|
||||
qs = HttpUtility.ParseQueryString(redirectUrl.Substring(epIndex));
|
||||
}
|
||||
|
||||
// substract Epoch to get a smaller number
|
||||
var refresh = _now.Ticks - Epoch;
|
||||
qs.Remove(RefreshKey);
|
||||
|
||||
qs.Add(RefreshKey, refresh.ToString("x"));
|
||||
var querystring = "?" + string.Join("&", Array.ConvertAll(qs.AllKeys, k => string.Format("{0}={1}", HttpUtility.UrlEncode(k), HttpUtility.UrlEncode(qs[k]))));
|
||||
|
||||
if (epIndex > 0) {
|
||||
redirectUrl = redirectUrl.Substring(0, epIndex) + querystring;
|
||||
}
|
||||
else {
|
||||
redirectUrl = redirectUrl + querystring;
|
||||
}
|
||||
}
|
||||
|
||||
filterContext.Result = new RedirectResult(redirectUrl, redirectResult.Permanent);
|
||||
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
|
||||
return true;
|
||||
@@ -602,6 +635,14 @@ namespace Orchard.OutputCache.Filters {
|
||||
return false;
|
||||
}
|
||||
|
||||
private int GetMaxAge() {
|
||||
return _cacheManager.Get("CacheSettingsPart.MaxAge",
|
||||
context => {
|
||||
context.Monitor(_signals.When(CacheSettingsPart.CacheKey));
|
||||
return _workContext.CurrentSite.As<CacheSettingsPart>().DefaultMaxAge;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -676,6 +717,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class ViewDataContainer : IViewDataContainer {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Projections {
|
||||
@@ -12,7 +13,7 @@ namespace Orchard.Projections {
|
||||
.Add(T("Queries"), "1.0",
|
||||
qi => qi.Action("Index", "Admin", new { area = "Orchard.Projections" }).Permission(Permissions.ManageQueries).LocalNav())
|
||||
.Add(T("Bindings"), "2.0",
|
||||
bi => bi.Action("Index", "Binding", new { area = "Orchard.Projections" }).Permission(Permissions.ManageQueries).LocalNav())
|
||||
bi => bi.Action("Index", "Binding", new { area = "Orchard.Projections" }).Permission(StandardPermissions.SiteOwner).LocalNav())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -43,7 +43,7 @@ namespace Orchard.Projections.Controllers {
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Add(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var viewModel = new FilterAddViewModel { Id = id, Filters = _projectionManager.DescribeFilters() };
|
||||
@@ -51,7 +51,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult AddGroup(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var query = _queryService.GetQuery(id).Record;
|
||||
@@ -67,7 +67,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult DeleteGroup(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var group = _groupRepository.Get(id);
|
||||
@@ -85,7 +85,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
|
||||
public ActionResult Delete(int id, int filterId) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var filter = _repository.Get(filterId);
|
||||
@@ -102,7 +102,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id, string category, string type, int filterId = -1) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var filter = _projectionManager.DescribeFilters().SelectMany(x => x.Descriptors).FirstOrDefault(x => x.Category == category && x.Type == type);
|
||||
|
@@ -42,7 +42,7 @@ namespace Orchard.Projections.Controllers {
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Add(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var viewModel = new LayoutAddViewModel { Id = id, Layouts = _projectionManager.DescribeLayouts() };
|
||||
@@ -51,7 +51,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var layout = _repository.Get(id);
|
||||
@@ -70,7 +70,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Create(int id, string category, string type) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var layout = _projectionManager.DescribeLayouts().SelectMany(x => x.Descriptors).FirstOrDefault(x => x.Category == category && x.Type == type);
|
||||
@@ -93,7 +93,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
public ActionResult CreatePost(LayoutEditViewModel model, FormCollection formCollection) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
// validating form values
|
||||
@@ -129,7 +129,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
LayoutRecord layoutRecord = _repository.Get(id);
|
||||
|
@@ -46,7 +46,7 @@ namespace Orchard.Projections.Controllers {
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Add(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var viewModel = new PropertyAddViewModel { Id = id, Properties = _projectionManager.DescribeProperties() };
|
||||
@@ -55,7 +55,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id, int propertyId) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var property = _repository.Get(propertyId);
|
||||
@@ -72,7 +72,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id, string category, string type, int propertyId = -1) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var property = _projectionManager.DescribeProperties().SelectMany(x => x.Descriptors).Where(x => x.Category == category && x.Type == type).FirstOrDefault();
|
||||
@@ -140,7 +140,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPost(int id, string category, string type, [DefaultValue(-1)]int propertyId, FormCollection formCollection) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
var layout = _layoutRepository.Get(id);
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Move(string direction, int id, int layoutId) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
switch (direction) {
|
||||
|
@@ -44,7 +44,7 @@ namespace Orchard.Projections.Controllers {
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Add(int id) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var viewModel = new SortCriterionAddViewModel { Id = id, SortCriteria = _projectionManager.DescribeSortCriteria() };
|
||||
@@ -53,7 +53,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
public ActionResult Delete(int id, int sortCriterionId) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var sortCriterion = _repository.Get(sortCriterionId);
|
||||
@@ -70,7 +70,7 @@ namespace Orchard.Projections.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id, string category, string type, int sortCriterionId = -1) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var sortCriterion = _projectionManager.DescribeSortCriteria().SelectMany(x => x.Descriptors).FirstOrDefault(x => x.Category == category && x.Type == type);
|
||||
@@ -158,7 +158,7 @@ namespace Orchard.Projections.Controllers {
|
||||
|
||||
|
||||
public ActionResult Move(string direction, int id, int queryId) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage queries")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageQueries, T("Not authorized to manage queries")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
switch (direction) {
|
||||
|
@@ -275,10 +275,10 @@ namespace Orchard.Users.Controllers {
|
||||
|
||||
if (user != null) {
|
||||
if (String.Equals(Services.WorkContext.CurrentSite.SuperUser, user.UserName, StringComparison.Ordinal)) {
|
||||
Services.Notifier.Error(T("The Super user can't be removed. Please disable this account or specify another Super user account"));
|
||||
Services.Notifier.Error(T("The Super user can't be removed. Please disable this account or specify another Super user account."));
|
||||
}
|
||||
else if (String.Equals(Services.WorkContext.CurrentUser.UserName, user.UserName, StringComparison.Ordinal)) {
|
||||
Services.Notifier.Error(T("You can't remove your own account. Please log in with another account"));
|
||||
Services.Notifier.Error(T("You can't remove your own account. Please log in with another account."));
|
||||
}
|
||||
else{
|
||||
Services.ContentManager.Remove(user.ContentItem);
|
||||
|
@@ -112,7 +112,7 @@ namespace Orchard.Security.Providers {
|
||||
// the cookie user data is {userId};{tenant}
|
||||
var userDataSegments = userData.Split(';');
|
||||
|
||||
if (userDataSegments.Length != 2) {
|
||||
if (userDataSegments.Length < 2) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user