mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 10:54:50 +08:00
16961 Remove manage users permission
--HG-- branch : dev
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Users {
|
||||
@@ -9,7 +10,7 @@ namespace Orchard.Users {
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
builder.Add(T("Users"), "40",
|
||||
menu => menu.Add(T("Users"), "1.0", item => item.Action("Index", "Admin", new { area = "Orchard.Users" })
|
||||
.Permission(Permissions.ManageUsers)));
|
||||
.Permission(StandardPermissions.SiteOwner)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -40,7 +40,7 @@ namespace Orchard.Users.Controllers {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to list users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to list users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var users = Services.ContentManager
|
||||
@@ -58,7 +58,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Create() {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.New<IUser>("User");
|
||||
@@ -73,7 +73,7 @@ namespace Orchard.Users.Controllers {
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
public ActionResult CreatePOST(UserCreateViewModel createModel) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (!string.IsNullOrEmpty(createModel.UserName)) {
|
||||
@@ -114,7 +114,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Edit(int id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get<UserPart>(id);
|
||||
@@ -129,7 +129,7 @@ namespace Orchard.Users.Controllers {
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPOST(int id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get<UserPart>(id);
|
||||
@@ -169,7 +169,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Delete(int id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")))
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get<IUser>(id);
|
||||
@@ -191,7 +191,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult SendChallengeEmail(int id) {
|
||||
if ( !Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")) )
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get(id);
|
||||
@@ -206,7 +206,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Approve(int id) {
|
||||
if ( !Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")) )
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get(id);
|
||||
@@ -220,7 +220,7 @@ namespace Orchard.Users.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Moderate(int id) {
|
||||
if ( !Services.Authorizer.Authorize(Permissions.ManageUsers, T("Not authorized to manage users")) )
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage users")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var user = Services.ContentManager.Get<IUser>(id);
|
||||
|
@@ -69,7 +69,6 @@
|
||||
<Compile Include="Handlers\UserPartHandler.cs" />
|
||||
<Compile Include="Models\UserPartRecord.cs" />
|
||||
<Compile Include="Models\UserStatus.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\IUserService.cs" />
|
||||
<Compile Include="Services\MembershipService.cs" />
|
||||
|
@@ -1,29 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Security.Permissions;
|
||||
|
||||
namespace Orchard.Users {
|
||||
[UsedImplicitly]
|
||||
public class Permissions : IPermissionProvider {
|
||||
public static readonly Permission ManageUsers = new Permission { Description = "Manage users", Name = "ManageUsers" };
|
||||
|
||||
public virtual Feature Feature { get; set; }
|
||||
|
||||
public IEnumerable<Permission> GetPermissions() {
|
||||
return new[] {
|
||||
ManageUsers,
|
||||
};
|
||||
}
|
||||
|
||||
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
||||
return new[] {
|
||||
new PermissionStereotype {
|
||||
Name = "Administrator",
|
||||
Permissions = new[] {ManageUsers}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user