Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "Vidyadhar"

Hi oguzhanagir, Thanks for the update, We placed the AddNewPermission() method in the PermissionAppService.cs file, but none of the methods in PermissionAppService.cs are accessible from the application. We added a constructor with IPermissionDefinitionContext: private readonly IPermissionDefinitionContext _permissionDefinitionContext; public PermissionAppService(IPermissionDefinitionContext permissionDefinitionContext) { _permissionDefinitionContext = permissionDefinitionContext; }

Then, we defined AddNewPermission() to add new permissions to an existing permission section: public void AddNewPermission(string permissionName) { var permissionProvider = new AppAuthorizationProvider(true); permissionProvider.AddPermission(_permissionDefinitionContext, permissionName); }

However, after adding this code, we are unable to access any methods in PermissionAppService.cs from the application. If the above issue resloves then we can find the value of permissionProvider variable in the AddNewPermission method Note: Add new permissions dynamically from the database table to the permissions tree section.

Hi, Any updates?

Regards, Vidyadhar.

Hi,

We're using ABP Zero Template version 10.0.0.0. We added a new method AddNewPermission() in PermissionAppService.cs to create a new permission from the database table.

Below is the sample code

PermissionAppService.cs: public void AddNewPermission(ImportLogData permissionDto) { var permissionProvider = new AppAuthorizationProvider(true); permissionProvider.AddPermission(_permissionDefinitionContext, permissionDto.Message); }

AppAuthorizationProvider.cs: public void AddPermission(IPermissionDefinitionContext context, string permissionName) { var myGroup = context.GetPermissionOrNull("Pages.Reports"); myGroup?.CreateChildPermission(permissionName, new FixedLocalizableString(permissionName)); }

We're unable to access the method in the application. Please review the screenshots below for reference.

<br> Could you help us how to add a new permission from the database table into SetPermissions() in AppAuthorizationProvider.cs?

Regards, Vidyadhar

Showing 1 to 3 of 3 entries