diff --git a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingPermissions.cs b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingPermissions.cs index e73dc334da..fae85acf88 100644 --- a/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingPermissions.cs +++ b/modules/blogging/src/Volo.Blogging.Application.Contracts/Volo/Blogging/BloggingPermissions.cs @@ -1,4 +1,6 @@ -namespace Volo.Blogging +using Volo.Abp.Reflection; + +namespace Volo.Blogging { public class BloggingPermissions { @@ -39,27 +41,7 @@ public static string[] GetAll() { - return new[] - { - GroupName, - Blogs.Default, - Blogs.Management, - Blogs.Delete, - Blogs.Update, - Blogs.Create, - Posts.Default, - Posts.Delete, - Posts.Update, - Posts.Create, - Tags.Default, - Tags.Delete, - Tags.Update, - Tags.Create, - Comments.Default, - Comments.Delete, - Comments.Update, - Comments.Create - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(BloggingPermissions)); } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs index 565b70c7f5..341f4c5819 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application.Contracts/Volo/Docs/Admin/DocsAdminPermissions.cs @@ -1,4 +1,6 @@ -namespace Volo.Docs.Admin +using Volo.Abp.Reflection; + +namespace Volo.Docs.Admin { public class DocsAdminPermissions { @@ -14,14 +16,7 @@ public static string[] GetAll() { - return new[] - { - GroupName, - Projects.Default, - Projects.Delete, - Projects.Update, - Projects.Create, - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(DocsAdminPermissions)); } } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs index 339122c2a8..e22869295f 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityPermissions.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.Identity +using Volo.Abp.Reflection; + +namespace Volo.Abp.Identity { public static class IdentityPermissions { @@ -29,21 +31,7 @@ public static string[] GetAll() { - return new[] - { - GroupName, - Roles.Default, - Roles.Create, - Roles.Update, - Roles.Delete, - Roles.ManagePermissions, - Users.Default, - Users.Create, - Users.Update, - Users.Delete, - Users.ManagePermissions, - UserLookup.Default - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(IdentityPermissions)); } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementPermissions.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementPermissions.cs index 6bc90271bc..49afb47c25 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementPermissions.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application.Contracts/Volo/Abp/TenantManagement/TenantManagementPermissions.cs @@ -1,4 +1,6 @@ -namespace Volo.Abp.TenantManagement +using Volo.Abp.Reflection; + +namespace Volo.Abp.TenantManagement { public static class TenantManagementPermissions { @@ -16,16 +18,7 @@ public static string[] GetAll() { - return new[] - { - GroupName, - Tenants.Default, - Tenants.Create, - Tenants.Update, - Tenants.Delete, - Tenants.ManageFeatures, - Tenants.ManageConnectionStrings - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(TenantManagementPermissions)); } } } \ No newline at end of file diff --git a/samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissions.cs b/samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissions.cs index b1ec575904..ea8a26d6ef 100644 --- a/samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissions.cs +++ b/samples/BookStore/src/Acme.BookStore.Application/Permissions/BookStorePermissions.cs @@ -1,4 +1,5 @@ using System; +using Volo.Abp.Reflection; namespace Acme.BookStore.Permissions { @@ -12,7 +13,7 @@ namespace Acme.BookStore.Permissions public static string[] GetAll() { //Return an array of all permissions - return Array.Empty(); + return ReflectionHelper.GetPublicConstantsRecursively(typeof(BookStorePermissions)); } } } \ No newline at end of file diff --git a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/ProductManagementPermissions.cs b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/ProductManagementPermissions.cs index b4dd949a73..eebc8cb29c 100644 --- a/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/ProductManagementPermissions.cs +++ b/samples/MicroserviceDemo/modules/product/src/ProductManagement.Application.Contracts/ProductManagement/ProductManagementPermissions.cs @@ -1,4 +1,6 @@ -namespace ProductManagement +using Volo.Abp.Reflection; + +namespace ProductManagement { public class ProductManagementPermissions { @@ -14,14 +16,7 @@ } public static string[] GetAll() { - return new[] - { - GroupName, - Products.Default, - Products.Delete, - Products.Update, - Products.Create - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(ProductManagementPermissions)); } } } \ No newline at end of file diff --git a/templates/module/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs b/templates/module/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs index 88e7a3c05b..00d1124498 100644 --- a/templates/module/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs +++ b/templates/module/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs @@ -1,4 +1,6 @@ -namespace MyCompanyName.MyProjectName +using Volo.Abp.Reflection; + +namespace MyCompanyName.MyProjectName { public class MyProjectNamePermissions { @@ -6,10 +8,7 @@ public static string[] GetAll() { - return new[] - { - GroupName - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(MyProjectNamePermissions)); } } } \ No newline at end of file diff --git a/templates/mvc/src/MyCompanyName.MyProjectName.Application/Permissions/MyProjectNamePermissions.cs b/templates/mvc/src/MyCompanyName.MyProjectName.Application/Permissions/MyProjectNamePermissions.cs index 4e499ae2ed..0646692500 100644 --- a/templates/mvc/src/MyCompanyName.MyProjectName.Application/Permissions/MyProjectNamePermissions.cs +++ b/templates/mvc/src/MyCompanyName.MyProjectName.Application/Permissions/MyProjectNamePermissions.cs @@ -1,4 +1,5 @@ using System; +using Volo.Abp.Reflection; namespace MyCompanyName.MyProjectName.Permissions { @@ -12,7 +13,7 @@ namespace MyCompanyName.MyProjectName.Permissions public static string[] GetAll() { //Return an array of all permissions - return Array.Empty(); + return ReflectionHelper.GetPublicConstantsRecursively(typeof(MyProjectNamePermissions)); } } } \ No newline at end of file diff --git a/templates/service/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs b/templates/service/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs index 88e7a3c05b..00d1124498 100644 --- a/templates/service/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs +++ b/templates/service/src/MyCompanyName.MyProjectName.Application.Contracts/MyCompanyName/MyProjectName/MyProjectNamePermissions.cs @@ -1,4 +1,6 @@ -namespace MyCompanyName.MyProjectName +using Volo.Abp.Reflection; + +namespace MyCompanyName.MyProjectName { public class MyProjectNamePermissions { @@ -6,10 +8,7 @@ public static string[] GetAll() { - return new[] - { - GroupName - }; + return ReflectionHelper.GetPublicConstantsRecursively(typeof(MyProjectNamePermissions)); } } } \ No newline at end of file