What I'm trying to do
- Each edition has a default tenant associated with it. This tenant can have some predefined users, roles, organizational units etc.
- When a new tenant is created using this edition, it will copy the relevant items from the default tenant
Issue that I'm facing
- In TenantManager.CreateWithAdminUserAsync, retrieve the role permissions using following statements
using (_unitOfWorkManager.Current.SetTenantId(defaultTenant.Id))
{
var defaultTenantRolePermissions = await _roleManager.GetGrantedPermissionsAsync(defaultTenantRole);
}
- While retrieving the permissions, following permissions are not returned from GetGrantedPermissionsAsync method
Pages.Tenant.DashboardPages.Administration.Tenant.Settings
However, this method works fine for all other permissions. Is there anything missing or needs to be done differently?
Thanks in advance.
14 Answer(s)
-
0
-
0
-
0
This behavior is consistent for all the permissions that are tenant-specific (i.e. defined with multiTenancySides: MultiTenancySides.Tenant). All the permissions common to both host and tenant are retrieved correctly from GetGrantedPermissionsAsync.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Following image shows the problem clearly
- FullUser role (Role Id: 5) with defaulTenant (Tenant Id: 2) has 7 permissions in database.
- While retrieving these permissions using RoleManager.GetGrantedPermissionsAsync, only 4 permissions are returned and the permission Pages.Tenant.Dashboard is not retrieved.
Can anybody please explain what is wrong with this or what am I missing? Thanks in advance.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @csona,
In order to understand your problem and offer a solution, is it possible for you to share your project and your database with [email protected] ?
Thanks,
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @ismcagdas,
Thank you for the reply. I have sent an email with required details as you have requested to [email protected]
- Archived copy of source code
- Database backup file
- Steps describing the user actions and problem
- Other relevant images
Please let me know if you need anything else from our side.
Thanks again.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @csona,
Thanks, we will get back to you via email.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @ismcagdas,
Thank you for the update.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
-
0
Hi @demirmusa,
Thank you for your reply.
Pleaes find below the database details from the database backup that we had sent attached in the email (GrowthPlanDB.bak).
- "DefaultStarterTenant" tenant has a role named "Full User" which has the permissions set as can be seen in the image below.
- "Full User" role for above mentioned tenant has following permissions as per the database entries
- Pages.Administration.AuditLogs
- Pages.Administration
- Pages
- Pages.Administration.Tenant.Settings
- Pages.Administration
- Pages
- Pages.Administration.UiCustomization
- Pages.Administration
- Pages
- Pages.Tenant.Dashboard
- Pages
- Pages.DxDataGrid
- Pages
Please let me know if we are misinterpreting or misunderstanding something.
Thanks.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Thanks @csona
I reproduced the problem. I will check it.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
Hi @csona
Since PermissionManager also use session information you should set session too. Can you please check if that work for you.
using (CurrentUnitOfWork.SetTenantId(2)) { + using (AbpSession.Use(2, null))//add this { var defaultTenantRolePermissions = await _roleManager.GetGrantedPermissionsAsync(5); return defaultTenantRolePermissions.Select(permission => permission.Name).ToList(); } }Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
1
Hi @demirmusa ,
We are verifying the solution that you have mentioned above and it seems to be working fine. We'll do some more testing and update accordingly.
Thank you so much for your time and help.
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image) -
0
You are always welcome 🙂
Markdown is supportedCopy & paste or drag & drop images (max 30 MB per image)




