Hi,
What is the best way to define permissions for a specific role by code in the Seed actions _(or somewhere else) _?
How is it handled for the admin default user in ANZ ?
I would like to automatically link permissions & roles by code for the first default startup of my app, and not to have to go to the interface.
Thanks
5 Answer(s)
-
0
Hi, you can assign permissions during tenant creation.
You can also create seed data similar to DefaultTenantBuilder, however, i would consider seed data as tenant specific defaults rather than user specific defaults
-
0
Thanks but what if i don't have Multitenancy ?
-
0
You can create your custom permission builder and use it in SeedHelper as it is always called in regardless of multitenancy flag
-
0
Yes but i need to give access to all permissions like this code :
var fullAdminRole = _roleManager.Roles.Single(r => r.Name == XXXXXX); await _roleManager.GrantAllPermissionsAsync(fullAdminRole);
Where is the best place for doing this in startup ? In SeedHelper ?
If so, how can i get the roleManager, should i get it from DI ?
Thanks
-
0
Hi, you can refer to the first reply for ANZ implementation