mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +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\ContentTypePartDefinitionRecord.cs" />
|
||||
<Compile Include="Settings\Models\SiteSettingsPartRecord.cs" />
|
||||
<Compile Include="Settings\Permissions.cs" />
|
||||
<Compile Include="Settings\State\Records\ShellFeatureStateRecord.cs" />
|
||||
<Compile Include="Settings\State\Records\ShellStateRecord.cs" />
|
||||
<Compile Include="Settings\State\ShellStateManager.cs" />
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Settings {
|
||||
@@ -9,7 +10,7 @@ namespace Orchard.Core.Settings {
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.Add(T("Configuration"), "50",
|
||||
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.ContentManagement;
|
||||
using Orchard.Localization.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
@@ -28,7 +29,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
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();
|
||||
|
||||
dynamic model = Services.ContentManager.BuildEditor(_siteService.GetSiteSettings());
|
||||
@@ -38,7 +39,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
|
||||
[HttpPost, ActionName("Index")]
|
||||
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();
|
||||
|
||||
var site = _siteService.GetSiteSettings();
|
||||
@@ -56,7 +57,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
|
||||
public ActionResult Culture() {
|
||||
//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();
|
||||
|
||||
var model = new SiteCulturesViewModel {
|
||||
@@ -72,7 +73,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
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();
|
||||
|
||||
cultureName = string.IsNullOrWhiteSpace(cultureName) ? systemCultureName : cultureName;
|
||||
@@ -85,7 +86,7 @@ namespace Orchard.Core.Settings.Controllers {
|
||||
|
||||
[HttpPost]
|
||||
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();
|
||||
|
||||
_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