16971: Merge comment permissions

--HG--
branch : dev
This commit is contained in:
Suha Can
2010-12-08 12:42:00 -08:00
parent dc1721ac49
commit 14df2a4fb7
2 changed files with 2 additions and 10 deletions

View File

@@ -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)) {

View File

@@ -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
};
}