Skip to content
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

Closed
wants to merge 3 commits into from
Closed

Add BuiltInRole #11981

wants to merge 3 commits into from

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Jul 9, 2022

Addresses #11920


public const string Editor = "Editor";

public const string Moderator = "Moderator";
Copy link
Contributor

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.

Copy link
Member Author

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 ..

Copy link
Member

@MikeAlhayek MikeAlhayek Jul 10, 2022

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

Copy link
Member Author

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hishamco How about changing the name to SecurityConstants instead?
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.

Copy link
Member Author

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 ;)

@hishamco hishamco closed this Jan 23, 2024
@hishamco hishamco deleted the hishamco/built-in-roles branch January 23, 2024 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants