-
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
Extend user permissions #12407
Extend user permissions #12407
Conversation
Why you merge the two fixes in the ssame PR, while one is related to roles?!! |
Because in this PR many roles related changes were done. But if you like more PR's, I can break this one into two :) |
I suggest to revert the roles changes and let the team decide what's the best approach before you waste a time and closing the PR |
@hishamco I split it into two PR. |
Random: if something is disabled in the UI be sure to do the same check in the controller to prevent security issues. |
@sebastienros can we review this on next triage? |
src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserRoleDisplayDriver.cs
Outdated
Show resolved
Hide resolved
...chardCore/OrchardCore.Infrastructure.Abstractions/Security/Services/RoleServiceExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Users/Services/RolesAdminListFilterProvider.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Users.Core/Indexes/UserRoleIndex.cs
Outdated
Show resolved
Hide resolved
@sebastienros I made all the requested changes and retested again. I also merged the 2 setting properties with |
@MikeAlhayek Okay, can't right now but will do another review asap. |
src/OrchardCore.Modules/OrchardCore.Users/Drivers/UserInformationDisplayDriver.cs
Outdated
Show resolved
Hide resolved
@MikeAlhayek Okay, so from memory before completing the review.
So looks like the only main remaining point is to discuss a little more to be sure of what is better to use, the existing |
@MikeAlhayek Okay so from memory the last things would be.
|
Strange, when I look at my production database, the
Yes I changed this. |
When we use the aspnet
Then this is the
Yes not good to use the I will have a meeting in 5 minutes, I will look at it later on. |
@jtkech yes I understand. Based on the code, normalized roles name should be store. But, when I look at my production database "using v1.5" I see |
Okay would be good to understand why, will see tomorrow
Yes I agree. Or maybe the opposite, because it is case insensitive it say that it already exists, need to be checked.
Yes would be good to understand, will see tomorrow ;) |
Anyway, any existing installation has at least the admin user with a non normalized "Administrator" role, so I think that for now we will not change anything about comparing Roles and User.RoleNames. But still worth to understand what hapenned in your case. |
@jtkech I changed the code in the driver and the views to do a case insensitive check. Everything is working as expected now at least for this PR. If you see no additional issues, lets finish it and merge it. As far as why my databases have standard name in the roleNames, I can't really explain it. The fact that I can't explain it is driving me nuts. |
I had no time to answer to your other comments, I will do. But for now
No problem, I could repro by resetting to an old version, so normally I will be able to find since when and why the RoleNames now are normalized (which is the right behavior). |
@jtkech no problem. I'll wait your respond. What version did you use to reproduce the name invariance issue? I want to see if we can spot the change the caused the change. Normalized name is the right one to store, but if we keep this change, we should also update the UserStore or event make RoleNames case-insensitive so we are not doing case insensitive check all over the place. Any additional changes, would be in a separate PR. I don't want to block this PR. |
@MikeAlhayek Here the history
So now we understand things, just need to think about what is now the best compromise to do.
We can't define a case-insensitive in the Document, when deserializing a json Document this is something that is not preserved. |
So in the previous
|
@jtkech I see the issue is caused by the change in the UserStore. I think we should submit a PR that would return the same behavior we had prior the last change. Then, maybe we can introduce a new PR that would change thing everywhere. I don't want to change the case sensitive check in this PR. If you agree with this approach, I can submit a quick fix for the |
# Conflicts: # src/OrchardCore.Modules/OrchardCore.Users/Services/SetupEventHandler.cs
Need to leave, will see tomorrow, anyway this PR will be merged tomorrow. |
@jtkech thanks for the fix in the other PR.
Yes I think they are all good additions. We now provide View profile function along with ListUsers permissions. I think this PR is ready. I'll give it another test tomorrow morning just to make sure everything is still working after the latest changes. I'll ping you again after I validate one last time. |
Yes, no luck about the case sensitivity, because of possible installations created since the last 10 days, but that's okay, there are not so many remaining Just committed a minor change for a missing usage of Then I will approve and let you retry it before merging. |
@jtkech I noticed a minor issue in the UI that I fixed. I'll merge it once the CLI is done. |
Fix #11762
Fix #12749
Replaces #11763
These changes were demonstrated during the Steering committee on 9/13/2022
Here is a summary of changes.
We add more permission to the Users module to make it more usable and robust for many use cases.
Also, we now have a settings that would allow the user to prevent username and/or email change on the edit screen.
Here is a screenshot of the new settings
Here is a screenshot of a user that is logged as admin.
Here is a screenshot of a user that can edit user's with
Author
role and onlyList users in role - Editor
and do NOT have permission toAssign users
. Note here the user has Edit permission toAuther
role, but since the user has no way to assign role, he is unable to create a user.Here is a screenshot of a user that can't view
Administrator
, can editAuthor
andEditor
, also can deleteAuthor
only