mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 09:37:46 +08:00

- Renamed permission tokens to prevent ambiguities - Corrected called permission from content controllers --HG-- branch : dev
55 lines
2.8 KiB
C#
55 lines
2.8 KiB
C#
using System.Collections.Generic;
|
|
using Orchard.Environment.Extensions.Models;
|
|
using Orchard.Security.Permissions;
|
|
|
|
namespace Orchard.Core.Contents {
|
|
public class Permissions : IPermissionProvider {
|
|
public static readonly Permission PublishContent = new Permission { Description = "Publish or unpublish content for others", Name = "PublishContent" };
|
|
public static readonly Permission PublishOwnContent = new Permission { Description = "Publish or unpublish content", Name = "PublishOwnContent", ImpliedBy = new[] { PublishContent } };
|
|
public static readonly Permission EditContent = new Permission { Description = "Edit content for others", Name = "EditContent", ImpliedBy = new[] { PublishContent } };
|
|
public static readonly Permission EditOwnContent = new Permission { Description = "Edit content", Name = "EditOwnContent", ImpliedBy = new[] { EditContent, PublishOwnContent } };
|
|
public static readonly Permission DeleteContent = new Permission { Description = "Delete content for others", Name = "DeleteContent" };
|
|
public static readonly Permission DeleteOwnContent = new Permission { Description = "Delete content", Name = "DeleteOwnContent", ImpliedBy = new[] { DeleteContent } };
|
|
|
|
public static readonly Permission MetaListContent = new Permission { ImpliedBy = new[] { EditOwnContent, PublishOwnContent, DeleteOwnContent } };
|
|
|
|
public virtual Feature Feature { get; set; }
|
|
|
|
public IEnumerable<Permission> GetPermissions() {
|
|
return new [] {
|
|
EditOwnContent,
|
|
EditContent,
|
|
PublishOwnContent,
|
|
PublishContent,
|
|
DeleteOwnContent,
|
|
DeleteContent,
|
|
};
|
|
}
|
|
|
|
public IEnumerable<PermissionStereotype> GetDefaultStereotypes() {
|
|
return new[] {
|
|
new PermissionStereotype {
|
|
Name = "Administrator",
|
|
Permissions = new[] {PublishContent,EditContent,DeleteContent}
|
|
},
|
|
new PermissionStereotype {
|
|
Name = "Editor",
|
|
Permissions = new[] {PublishContent,EditContent,DeleteContent}
|
|
},
|
|
new PermissionStereotype {
|
|
Name = "Moderator",
|
|
//Permissions = new[] {}
|
|
},
|
|
new PermissionStereotype {
|
|
Name = "Author",
|
|
Permissions = new[] {PublishOwnContent,EditOwnContent,DeleteOwnContent}
|
|
},
|
|
new PermissionStereotype {
|
|
Name = "Contributor",
|
|
Permissions = new[] {EditOwnContent}
|
|
},
|
|
};
|
|
}
|
|
|
|
}
|
|
} |