mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-24 13:33:34 +08:00
16976 Remove change owner of item permission
--HG-- branch : dev
This commit is contained in:
@@ -157,7 +157,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
var user = contentManager.New<IUser>("User");
|
||||
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
|
||||
_authz.Setup(x => x.TryCheckAccess(Permissions.ChangeOwner, user, item)).Returns(true);
|
||||
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
|
||||
|
||||
item.Owner = user;
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Orchard.Core.Tests.Common.Providers {
|
||||
|
||||
var user = contentManager.New<IUser>("User");
|
||||
_authn.Setup(x => x.GetAuthenticatedUser()).Returns(user);
|
||||
_authz.Setup(x => x.TryCheckAccess(Permissions.ChangeOwner, user, item)).Returns(true);
|
||||
_authz.Setup(x => x.TryCheckAccess(StandardPermissions.SiteOwner, user, item)).Returns(true);
|
||||
|
||||
item.Owner = user;
|
||||
|
||||
|
@@ -57,7 +57,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
DriverResult OwnerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var currentUser = _authenticationService.GetAuthenticatedUser();
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
|
||||
if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
DriverResult ContainerEditor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var currentUser = _authenticationService.GetAuthenticatedUser();
|
||||
if (!_authorizationService.TryCheckAccess(Permissions.ChangeOwner, currentUser, part)) {
|
||||
if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@@ -1,26 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Security.Permissions;
|
||||
|
||||
namespace Orchard.Core.Common {
|
||||
public class Permissions : IPermissionProvider {
|
||||
public static readonly Permission ChangeOwner = new Permission { Name = "ChangeOwner", Description = "Change the owner of content items" };
|
||||
|
||||
public virtual Feature Feature { get; set; }
|
||||
|
||||
public IEnumerable<Permission> GetPermissions() {
|
||||
return new[] {
|
||||
ChangeOwner,
|
||||
};
|
||||
}
|
||||
|
||||
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
||||
return new[] {
|
||||
new PermissionStereotype {
|
||||
Name = "Administrator",
|
||||
Permissions = new[] {ChangeOwner}
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -120,7 +120,6 @@
|
||||
<Compile Include="Routable\Handlers\RoutePartHandler.cs" />
|
||||
<Compile Include="Routable\IRoutablePathConstraint.cs" />
|
||||
<Compile Include="Routable\Models\RoutePart.cs" />
|
||||
<Compile Include="Common\Permissions.cs" />
|
||||
<Compile Include="Common\Utilities\LazyField.cs" />
|
||||
<Compile Include="Common\Handlers\CommonPartHandler.cs" />
|
||||
<Compile Include="Common\Models\CommonPart.cs" />
|
||||
|
Reference in New Issue
Block a user