mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
16971: Merge comment permissions
--HG-- branch : dev
This commit is contained in:
@@ -231,7 +231,7 @@ namespace Orchard.Comments.Controllers {
|
||||
[HttpPost]
|
||||
public ActionResult Close(int commentedItemId, string returnUrl) {
|
||||
try {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CloseComment, T("Couldn't close comments")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't close comments")))
|
||||
return new HttpUnauthorizedResult();
|
||||
_commentService.CloseCommentsForCommentedContent(commentedItemId);
|
||||
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||
@@ -251,7 +251,7 @@ namespace Orchard.Comments.Controllers {
|
||||
[HttpPost]
|
||||
public ActionResult Enable(int commentedItemId, string returnUrl) {
|
||||
try {
|
||||
if (!Services.Authorizer.Authorize(Permissions.EnableComment, T("Couldn't enable comments")))
|
||||
if (!Services.Authorizer.Authorize(Permissions.ManageComments, T("Couldn't enable comments")))
|
||||
return new HttpUnauthorizedResult();
|
||||
_commentService.EnableCommentsForCommentedContent(commentedItemId);
|
||||
if (!String.IsNullOrEmpty(returnUrl)) {
|
||||
|
@@ -5,22 +5,14 @@ using Orchard.Security.Permissions;
|
||||
namespace Orchard.Comments {
|
||||
public class Permissions : IPermissionProvider {
|
||||
public static readonly Permission AddComment = new Permission { Description = "Add comment", Name = "AddComment" };
|
||||
public static readonly Permission EnableComment = new Permission { Description = "Enabling Comments on content items", Name = "EnableComment" };//refactoring
|
||||
public static readonly Permission CloseComment = new Permission { Description = "Closing Comments", Name = "CloseComment" };//refactoring
|
||||
public static readonly Permission CloseCommentOnOwnItems = new Permission { Description = "Closing Comments on own items", Name = "CloseCommentOnOwnItems" };//refactoring
|
||||
public static readonly Permission ManageComments = new Permission { Description = "Manage comments", Name = "ManageComments" };
|
||||
public static readonly Permission ManageOthersComments = new Permission { Description = "Manage comments for others", Name = "ManageOthersComments" };
|
||||
|
||||
public virtual Feature Feature { get; set; }
|
||||
|
||||
public IEnumerable<Permission> GetPermissions() {
|
||||
return new[] {
|
||||
AddComment,
|
||||
EnableComment,
|
||||
CloseComment,
|
||||
CloseCommentOnOwnItems,
|
||||
ManageComments,
|
||||
ManageOthersComments
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user