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

condition change to support password reset #5053

Open
wants to merge 4 commits into
base: develop/6
Choose a base branch
from

Conversation

chavakula
Copy link

@chavakula chavakula commented Feb 14, 2024

What is this change?

This change allows web UI users to update password by themselves.

Why is this change necessary?

feature request in ticket https://github.com/sensu/sensu-enterprise-go/issues/2631

Does your change need a Changelog entry?

requires entry to changelog, api documentation

Do you need clarification on anything?

Were there any complications while making this change?

Have you reviewed and updated the documentation for this change? Is new documentation required?

How did you verify this change?

Manual testing done, attached recording.

Screen.Recording.2024-02-14.at.9.46.00.PM.mov

Is this change a patch?

Signed-off-by: Rajshekar Chavakula <rchavakula.ctr@sumologic.com>
Signed-off-by: Rajshekar Chavakula <rchavakula.ctr@sumologic.com>
@chavakula chavakula marked this pull request as ready for review February 29, 2024 08:59
@fguimond
Copy link
Contributor

Don't forget the changelog entry :)

Signed-off-by: Rajshekar Chavakula <rchavakula.ctr@sumologic.com>
Copy link
Contributor

@echlebek echlebek left a comment

Choose a reason for hiding this comment

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

Please do not merge.

Comment on lines 96 to 102
// Change the resource to LocalSelfUserResource if a user tries to change
// its own password
if attrs.Verb == "update" && vars["subresource"] == "password" {
// check if request comes from webui
if strings.Contains(r.URL.Path, "/change_password") {
attrs.Resource = types.LocalSelfUserResource
}

switch vars["subresource"] {
case "password":
Copy link
Contributor

Choose a reason for hiding this comment

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

This code should work in terms of the RBAC system only, and not rely on inspecting URL fragments.

Copy link
Author

Choose a reason for hiding this comment

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

@echlebek & @fguimond have made the change, removed check on URL fragment. it will now check sub resource.

Signed-off-by: Rajshekar Chavakula <rchavakula.ctr@sumologic.com>
@chavakula chavakula requested a review from echlebek March 15, 2024 06:30
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.

None yet

3 participants