mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Added specific permission to change owner of content item (#8539)
This commit is contained in:
parent
ebfd03df0e
commit
5b0c82d1ad
@ -35,7 +35,7 @@ namespace Orchard.Core.Common.OwnerEditor {
|
|||||||
|
|
||||||
protected override DriverResult Editor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
protected override DriverResult Editor(CommonPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||||
var currentUser = _authenticationService.GetAuthenticatedUser();
|
var currentUser = _authenticationService.GetAuthenticatedUser();
|
||||||
if (!_authorizationService.TryCheckAccess(StandardPermissions.SiteOwner, currentUser, part)) {
|
if (!_authorizationService.TryCheckAccess(OwnerEditorPermissions.MayEditContentOwner, currentUser, part)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
|
using Orchard.Security;
|
||||||
|
using Orchard.Security.Permissions;
|
||||||
|
|
||||||
|
namespace Orchard.Core.Common.OwnerEditor {
|
||||||
|
public class OwnerEditorPermissions : IPermissionProvider {
|
||||||
|
|
||||||
|
public static readonly Permission MayEditContentOwner = new Permission {
|
||||||
|
Description = "Edit the Owner of content items",
|
||||||
|
Name = "MayEditContentOwner",
|
||||||
|
ImpliedBy = new[] { StandardPermissions.SiteOwner } };
|
||||||
|
|
||||||
|
public virtual Feature Feature { get; set; }
|
||||||
|
|
||||||
|
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
||||||
|
return new[] {new PermissionStereotype {
|
||||||
|
Name = "Administrator",
|
||||||
|
Permissions = new[] { MayEditContentOwner }
|
||||||
|
} };
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Permission> GetPermissions() {
|
||||||
|
return new[] { MayEditContentOwner };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -98,6 +98,7 @@
|
|||||||
<Compile Include="Common\Controllers\ErrorController.cs" />
|
<Compile Include="Common\Controllers\ErrorController.cs" />
|
||||||
<Compile Include="Common\DateEditor\DateEditorSettings.cs" />
|
<Compile Include="Common\DateEditor\DateEditorSettings.cs" />
|
||||||
<Compile Include="Common\Extensions\CommonMetaDataExtensions.cs" />
|
<Compile Include="Common\Extensions\CommonMetaDataExtensions.cs" />
|
||||||
|
<Compile Include="Common\OwnerEditor\OwnerEditorPermissions.cs" />
|
||||||
<Compile Include="Common\OwnerEditor\OwnerEditorSettings.cs" />
|
<Compile Include="Common\OwnerEditor\OwnerEditorSettings.cs" />
|
||||||
<Compile Include="Common\OwnerEditor\OwnerEditorDriver.cs" />
|
<Compile Include="Common\OwnerEditor\OwnerEditorDriver.cs" />
|
||||||
<Compile Include="Common\DateEditor\DateEditorDriver.cs" />
|
<Compile Include="Common\DateEditor\DateEditorDriver.cs" />
|
||||||
@ -662,4 +663,4 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
|
<Error Condition="!Exists('..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.1\build\net46\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user