-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create system roles by default #17341
base: main
Are you sure you want to change the base?
Conversation
@hishamco I know this is a draft. But I think you are missing the ask. Not all these roles are system role. There are currently only 3 system roles. Administration (this name could be changed), Anonymous, and Authorized. You should inject ISystemRolePrpvider to get a list of the system roles. OrchardCore/src/OrchardCore/OrchardCore.Roles.Abstractions/ISystemRoleNameProvider.cs Line 5 in a2f45e5
In the roles module, create a SystemRolesMigrations file that would read the system roles from the provider and create them using the RoleManager. Then you can remove only these 3 roles from the recipes. |
Thanks it is still a draft, I added the system roles first, then added the rest accidentally Using the provider is much better, I will react to your feedback |
@MikeAlhayek I didn't see a description there, or shall we make |
I tried the PR on a fresh installation and it works fine but I don't know why it fails in Linux |
|
||
public async Task<int> CreateAsync() | ||
{ | ||
var systemRoles = await _systemRoleNameProvider.GetSystemRolesAsync(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am wondering if there is a raise condition somewhere.
Try implementing this logic using recipe step instead. You could do the same thing using IFeatureEventHandler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mean calling RoleStep
inside the data migration? If yes the RecipeExecutionContext
will be missing, we could find a way to pass it in but it will become more complicated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure out there're roles in the test recipe :)
Fixes #17271