Hello Support,
We are trying to set some default permissions to the tenants and don't allow them to update the permissions. But when we are trying to assign those from the backend, then those are not affecting the application. Like we want to assign dashboard permission to one tenant later and we executed the below query to assign but it doesn't affect on the front side.
INSERT INTO AbpPermissions(CreationTime, Discriminator, IsGranted, Name, TenantId,RoleId)
Values (GETDATE(),'RolePermissionSetting',1,'Pages.Tenant.Dashboard',124,244)
Could you please guide us how we can do this from the backend?
Thanks
3 Answer(s)
-
0
Hi @brightpath,
Permissions are cached, so you should use RoleManager's GrantPermissionAsync method to grant a permission to a role.
Thanks.
-
0
<cite>ismcagdas: </cite> Hi @brightpath,
Permissions are cached, so you should use RoleManager's GrantPermissionAsync method to grant a permission to a role.
Thanks.
How are we supposed to do this via migrations?
We have added a new set of pages with their own permissions (that are non-revokable), so how do we assign those permissions to existing users when we run the database migration?
-
0
Restarting the application and AppPool may be sufficient to reset the cache. Alternatively, you can inject ICacheManager and clear the cache yourself:
_cacheManager.GetRolePermissionCache().Clear(); _cacheManager.GetUserPermissionCache().Clear();