mirror of https://github.com/abpframework/abp.git
10 changed files with 121 additions and 60 deletions
@ -0,0 +1,32 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
using Volo.Abp.Authorization.Permissions; |
|||
using Volo.Abp.Localization; |
|||
using Volo.Blogging.Localization; |
|||
|
|||
namespace Volo.Blogging |
|||
{ |
|||
public class BloggingPermissionDefinitionProvider : PermissionDefinitionProvider |
|||
{ |
|||
public override void Define(IPermissionDefinitionContext context) |
|||
{ |
|||
var bloggingGroup = context.AddGroup(BloggingPermissions.GroupName, L("Permission:Blogging")); |
|||
|
|||
var blogs = bloggingGroup.AddPermission(BloggingPermissions.Blogs.Default, L("Permission:BlogManagement")); |
|||
blogs.AddChild(BloggingPermissions.Blogs.Update, L("Permission:Edit")); |
|||
blogs.AddChild(BloggingPermissions.Blogs.Delete, L("Permission:Delete")); |
|||
blogs.AddChild(BloggingPermissions.Blogs.Create, L("Permission:Delete")); |
|||
|
|||
var posts = bloggingGroup.AddPermission(BloggingPermissions.Posts.Default, L("Permission:PostManagement")); |
|||
posts.AddChild(BloggingPermissions.Posts.Update, L("Permission:Edit")); |
|||
posts.AddChild(BloggingPermissions.Posts.Delete, L("Permission:Delete")); |
|||
posts.AddChild(BloggingPermissions.Posts.Create, L("Permission:Delete")); |
|||
} |
|||
|
|||
private static LocalizableString L(string name) |
|||
{ |
|||
return LocalizableString.Create<BloggingResource>(name); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Text; |
|||
|
|||
namespace Volo.Blogging |
|||
{ |
|||
public class BloggingPermissions |
|||
{ |
|||
public const string GroupName = "Blogging"; |
|||
|
|||
public static class Blogs |
|||
{ |
|||
public const string Default = GroupName + ".Blog"; |
|||
public const string Delete = Default + ".Delete"; |
|||
public const string Update = Default + ".Update"; |
|||
public const string Create = Default + ".Create"; |
|||
} |
|||
|
|||
public static class Posts |
|||
{ |
|||
public const string Default = GroupName + ".Post"; |
|||
public const string Delete = Default + ".Delete"; |
|||
public const string Update = Default + ".Update"; |
|||
public const string Create = Default + ".Create"; |
|||
} |
|||
|
|||
public static string[] GetAll() |
|||
{ |
|||
return new[] |
|||
{ |
|||
GroupName, |
|||
Blogs.Default, |
|||
Blogs.Delete, |
|||
Blogs.Update, |
|||
Blogs.Create, |
|||
Posts.Default, |
|||
Posts.Delete, |
|||
Posts.Update, |
|||
Posts.Create |
|||
}; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue