Hi @oguzhanagir ,
We are using Asp.net Zero V 13.3.0 with.NET Core and Angular.
We have created a dynamic permission and assigned it to a role. However, we are facing an issue where we need to retrieve data from the AbpPermissions SQL table. We attempted to implement the repository pattern, but we are unable to create a repository for the AbpPermissions table. How can we retrieve records from the AbpPermissions table?
here We have created dynamic company permissions that are not defined in the AppPermissions.cs file but have been assigned to the Admin role. These permissions have been inserted as records into the AbpPermissions table, and we want to retrieve those records.
11 Answer(s)
-
0
Hi @oguzhanagir,
Could You please any update?
-
0
Hi @[email protected],
Could you check
PermissionManager
?https://aspnetboilerplate.com/Pages/Documents/Zero/Permission-Management#role-permissions
-
0
Hi @[email protected],
Could you check
PermissionManager
?https://aspnetboilerplate.com/Pages/Documents/Zero/Permission-Management#role-permissions
we want to get Role wise Permission AbpPermission Table record .but here not getting records.
User role we have assigned company Permisison.AbpPermission table records is there but not got here .
-
0
Hi , this is my code i have created dynamic Permission
public static class PermissionManagerExtensions { /// <summary> /// Gets all permissions by names. /// Throws <see cref="AbpValidationException"/> if can not find any of the permission names. /// </summary> /// public static IEnumerable<Permission> GetPermissionsFromNamesByValidating(this IPermissionManager permissionManager, IEnumerable<string> permissionNames, IRepository<ModulePermission, long> modulePermissionRepository) { var permissions = new List<Permission>(); var undefinedPermissionNames = new List<string>(); var staticPermissionNames = modulePermissionRepository.GetAll() .Select(mp => mp.Name) .ToList(); foreach (var permissionName in permissionNames) { Permission permission = null; if (staticPermissionNames.Contains(permissionName)) { // Optionally, create a Permission object for static permissions permission = new Permission(permissionName); // Adjust based on your Permission class } else { // Check with permissionManager permission = permissionManager.GetPermissionOrNull(permissionName); } if (permission != null) { permissions.Add(permission); } else { undefinedPermissionNames.Add(permissionName); } } if (undefinedPermissionNames.Count > 0) { throw new AbpValidationException($"There are {undefinedPermissionNames.Count} undefined permission names.") { ValidationErrors = undefinedPermissionNames.Select(permissionName => new ValidationResult("Undefined permission: " + permissionName)).ToList() }; } return permissions; } }
-
0
Hi,
Do you get these records when you restart your app ?
-
0
Hi,
Do you get these records when you restart your app ?
Yes.
-
0
Thanks. Could you share where do you use
PermissionManagerExtensions
? I assume it is used inside a code block which uses caching. -
0
-
0
Hi ismcagdas,
my issue is i want to get records for role Admin,user etc form Abppermisison table. how to get all records from abpPermission table.
-
0
Thanks. Could you share where do you use
PermissionManagerExtensions
? I assume it is used inside a code block which uses caching.any update ?
-
0
Hi
Have you tried retrieving the data in AbpPermissions in this way?
var permissions = PermissionManager.GetAllPermissions();