mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
16968 Remove manage search index permission
--HG-- branch : dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.UI.Navigation;
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
namespace Orchard.Indexing {
|
namespace Orchard.Indexing {
|
||||||
@@ -9,7 +10,7 @@ namespace Orchard.Indexing {
|
|||||||
public void GetNavigation(NavigationBuilder builder) {
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
builder.Add(T("Configuration"), "50",
|
builder.Add(T("Configuration"), "50",
|
||||||
menu => menu.Add(T("Search Index"), "15", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
|
menu => menu.Add(T("Search Index"), "15", item => item.Action("Index", "Admin", new {area = "Orchard.Indexing"})
|
||||||
.Permission(Permissions.ManageSearchIndex)));
|
.Permission(StandardPermissions.SiteOwner)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,6 +1,7 @@
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Indexing.Services;
|
using Orchard.Indexing.Services;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
|
using Orchard.Security;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
using Orchard.Indexing.ViewModels;
|
using Orchard.Indexing.ViewModels;
|
||||||
|
|
||||||
@@ -28,7 +29,7 @@ namespace Orchard.Indexing.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Update() {
|
public ActionResult Update() {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSearchIndex, T("Not allowed to manage the search index.")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_indexingService.UpdateIndex();
|
_indexingService.UpdateIndex();
|
||||||
@@ -38,7 +39,7 @@ namespace Orchard.Indexing.Controllers {
|
|||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public ActionResult Rebuild() {
|
public ActionResult Rebuild() {
|
||||||
if (!Services.Authorizer.Authorize(Permissions.ManageSearchIndex, T("Not allowed to manage the search index.")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
_indexingService.RebuildIndex();
|
_indexingService.RebuildIndex();
|
||||||
|
@@ -55,7 +55,6 @@
|
|||||||
<Compile Include="Handlers\InfosetFieldIndexingHandler.cs" />
|
<Compile Include="Handlers\InfosetFieldIndexingHandler.cs" />
|
||||||
<Compile Include="Models\IndexingTask.cs" />
|
<Compile Include="Models\IndexingTask.cs" />
|
||||||
<Compile Include="Models\IndexingTaskRecord.cs" />
|
<Compile Include="Models\IndexingTaskRecord.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
|
||||||
<Compile Include="Services\IndexServiceNotificationProvider.cs" />
|
<Compile Include="Services\IndexServiceNotificationProvider.cs" />
|
||||||
<Compile Include="Services\IndexingBackgroundTask.cs" />
|
<Compile Include="Services\IndexingBackgroundTask.cs" />
|
||||||
<Compile Include="Services\IndexingTaskExecutor.cs" />
|
<Compile Include="Services\IndexingTaskExecutor.cs" />
|
||||||
|
@@ -1,24 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
|
||||||
using Orchard.Security.Permissions;
|
|
||||||
|
|
||||||
namespace Orchard.Indexing {
|
|
||||||
public class Permissions : IPermissionProvider {
|
|
||||||
public static readonly Permission ManageSearchIndex = new Permission { Description = "Manage Search Index", Name = "ManageSearchIndex" };
|
|
||||||
|
|
||||||
public virtual Feature Feature { get; set; }
|
|
||||||
|
|
||||||
public IEnumerable<Permission> GetPermissions() {
|
|
||||||
return new[] { ManageSearchIndex };
|
|
||||||
}
|
|
||||||
|
|
||||||
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
|
||||||
return new[] {
|
|
||||||
new PermissionStereotype {
|
|
||||||
Name = "Administrator",
|
|
||||||
Permissions = new [] { ManageSearchIndex }
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Reference in New Issue
Block a user