Hi,
When I create a new tenant, I would like the default "User" role to include the "Pages_Tenant_Dashboard" permission by default?
I can see in the "CreateWithAdminUserAsync" method in TentantManager.cs there is some code that adds ALL permissions for the default "Admin" role. However, I cannot figure out how to add a single permission for the default "User" role.
I tried a few different things, but found the Core project doesn't include a way to get a list of permissions? If it did, I could try inserting a line something like below;
await _userRole = _roleManager.GrantPermissionAsync(userRole, myPermission);
But can't find a way to set "myPermission" here?
Any help much appreciated!
2 Answer(s)
-
0
Hi,
Inject IPermissionManager into TenantManager and use it like this.
await _roleManager.GrantPermissionAsync(userRole, _permissionManager.GetPermission(AppPermissions.Pages_Tenant_Dashboard));
-
0
Excellent, injecting IPermissionManager into TenantManager worked beautifully!
Thank you ismcagdas :D