mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
16972 Remove settings permissions
--HG-- branch : dev
This commit is contained in:
@@ -196,7 +196,6 @@
|
|||||||
<Compile Include="Settings\Metadata\Records\ContentTypeDefinitionRecord.cs" />
|
<Compile Include="Settings\Metadata\Records\ContentTypeDefinitionRecord.cs" />
|
||||||
<Compile Include="Settings\Metadata\Records\ContentTypePartDefinitionRecord.cs" />
|
<Compile Include="Settings\Metadata\Records\ContentTypePartDefinitionRecord.cs" />
|
||||||
<Compile Include="Settings\Models\SiteSettingsPartRecord.cs" />
|
<Compile Include="Settings\Models\SiteSettingsPartRecord.cs" />
|
||||||
<Compile Include="Settings\Permissions.cs" />
|
|
||||||
<Compile Include="Settings\State\Records\ShellFeatureStateRecord.cs" />
|
<Compile Include="Settings\State\Records\ShellFeatureStateRecord.cs" />
|
||||||
<Compile Include="Settings\State\Records\ShellStateRecord.cs" />
|
<Compile Include="Settings\State\Records\ShellStateRecord.cs" />
|
||||||
<Compile Include="Settings\State\ShellStateManager.cs" />
|
<Compile Include="Settings\State\ShellStateManager.cs" />
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.UI.Navigation;
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
namespace Orchard.Core.Settings {
|
namespace Orchard.Core.Settings {
|
||||||
@@ -9,7 +10,7 @@ namespace Orchard.Core.Settings {
|
|||||||
public void GetNavigation(NavigationBuilder builder) {
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
builder.Add(T("Configuration"), "50",
|
builder.Add(T("Configuration"), "50",
|
||||||
menu => menu.Add(T("Settings"), "10", item => item.Action("Index", "Admin", new { area = "Settings" })
|
menu => menu.Add(T("Settings"), "10", item => item.Action("Index", "Admin", new { area = "Settings" })
|
||||||
.Permission(Permissions.ManageSettings)));
|
.Permission(StandardPermissions.SiteOwner)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ using Orchard.Core.Settings.ViewModels;
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Localization.Services;
|
using Orchard.Localization.Services;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.Settings;
|
using Orchard.Settings;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
public Localizer T { get; set; }
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
public ActionResult Index(string tabName) {
|
public ActionResult Index(string tabName) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSettings, T("Not authorized to manage settings")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
dynamic model = Services.ContentManager.BuildEditor(_siteService.GetSiteSettings());
|
dynamic model = Services.ContentManager.BuildEditor(_siteService.GetSiteSettings());
|
||||||
@@ -38,7 +39,7 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
|
|
||||||
[HttpPost, ActionName("Index")]
|
[HttpPost, ActionName("Index")]
|
||||||
public ActionResult IndexPOST(string tabName) {
|
public ActionResult IndexPOST(string tabName) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSettings, T("Not authorized to manage settings")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
var site = _siteService.GetSiteSettings();
|
var site = _siteService.GetSiteSettings();
|
||||||
@@ -56,7 +57,7 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
|
|
||||||
public ActionResult Culture() {
|
public ActionResult Culture() {
|
||||||
//todo: class and/or method attributes for our auth?
|
//todo: class and/or method attributes for our auth?
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSettings, T("Not authorized to manage settings")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
var model = new SiteCulturesViewModel {
|
var model = new SiteCulturesViewModel {
|
||||||
@@ -72,7 +73,7 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult AddCulture(string systemCultureName, string cultureName) {
|
public ActionResult AddCulture(string systemCultureName, string cultureName) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSettings, T("Not authorized to manage settings")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
cultureName = string.IsNullOrWhiteSpace(cultureName) ? systemCultureName : cultureName;
|
cultureName = string.IsNullOrWhiteSpace(cultureName) ? systemCultureName : cultureName;
|
||||||
@@ -85,7 +86,7 @@ namespace Orchard.Core.Settings.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult DeleteCulture(string cultureName) {
|
public ActionResult DeleteCulture(string cultureName) {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSettings, T("Not authorized to manage settings")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage settings")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_cultureManager.DeleteCulture(cultureName);
|
_cultureManager.DeleteCulture(cultureName);
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
|
||||||
using Orchard.Security.Permissions;
|
|
||||||
|
|
||||||
namespace Orchard.Core.Settings {
|
|
||||||
public class Permissions : IPermissionProvider {
|
|
||||||
public static readonly Permission ManageSettings = new Permission { Name = "ManageSettings", Description = "Manage site settings" };
|
|
||||||
public static readonly Permission ChangeSuperuser = new Permission { Name = "ChangeSuperuser", Description = "Change the superuser for the site" };
|
|
||||||
|
|
||||||
public virtual Feature Feature { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<Permission> GetPermissions() {
|
|
||||||
return new[] {
|
|
||||||
ManageSettings,
|
|
||||||
ChangeSuperuser,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
|
||||||
return new[] {
|
|
||||||
new PermissionStereotype {
|
|
||||||
Name = "Administrator",
|
|
||||||
Permissions = new[] {ManageSettings}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user