-
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
Add BuiltInRole #11981
Add BuiltInRole #11981
Conversation
|
||
public const string Editor = "Editor"; | ||
|
||
public const string Moderator = "Moderator"; |
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.
Not sure that "Author, Contributor, Editor, Moderator" should be considered built-in roles. Sometimes people want to remove them because they have no use for them.
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.
Right, but they are builtin once in OC,. We could add a method say GetBuiltInRoles()
that can be virtual
The PR still WIP, hope to update it frequently ..
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.
@Skrypt I tried to go down that path of removing these roles at one point, but there is no way to remove unwanted roles now since all these roles are populated using IPermissionProvider.GetDefaultStereotypes()
from the IoC container. Roles can be removed after the site setup but there is no way to control the default roles using a recipe for example. (ex., create a site without the Moderator
or Editor
roles). Currently, you can add roles via recipe but you can't these default roles.
But I think we should be able to remove default roles. I pitched one way to allow us to delete roles here
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.
Please hold on until the PR is almost ready
|
||
namespace OrchardCore.Security | ||
{ | ||
public static class BuiltInRole |
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.
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.
BuiltInRole
is much cleaner and inspired by .NET enum
Also, in #11920 you said you were going to provide ways to localize these constants, I don't see how localization is will be supported here.
It's still WIP don't expect all the things in the first commits ;)
Addresses #11920