-
Notifications
You must be signed in to change notification settings - Fork 898
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
Do not change current_group for super admin user when executing Rbac#lookup_user_group #17347
Do not change current_group for super admin user when executing Rbac#lookup_user_group #17347
Conversation
…lookup_user_group Example when updating user.current_group in group's look-up is bad: if widget set-up for different group than during content generation (triggered manually from UI) the last group will become current group for super user and this may throw unexpectd errors ( like failing ApplicationController.assert_privileges(widget_refresh) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1564986
@yrudman should this still be WIP? just double checking. |
1baf52a
to
911af7e
Compare
@gtanzillo It looks strange when we change |
@miq-bot add_label blocker |
@yrudman if this can be backported, can you add the gaprindashvili/yes and fine/yes labels. |
lib/rbac/filterer.rb
Outdated
@@ -573,16 +573,18 @@ def lookup_user_group(user, userid, miq_group, miq_group_id) | |||
miq_group_id ||= miq_group.try!(:id) | |||
return [user, user.current_group] if user && user.current_group_id.to_s == miq_group_id.to_s | |||
|
|||
found_group = user.try(:current_group) |
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.
Is this line needed?
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.
Maybe it belongs in the missing else
before line 583 instead? Then it can be found_group = if...
and drop all of the variable setting below.
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.
@bdunne 👍 it looks much cleaner
Checked commits yrudman/manageiq@d7a37e8~...c798fc5 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
…oup-when-do-rback-search Do not change current_group for super admin user when executing Rbac#lookup_user_group (cherry picked from commit 2d81fce) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1573539
Gaprindashvili backport details:
|
…oup-when-do-rback-search Do not change current_group for super admin user when executing Rbac#lookup_user_group (cherry picked from commit 2d81fce) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1573540
Fine backport details:
|
…rrent-group-when-do-rback-search Do not change current_group for super admin user when executing Rbac#lookup_user_group (cherry picked from commit 2d81fce) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1573540
Changing
user.current_user
for superadmin and assigning group this admin does not belong-to may trigger not expected errors,like below error raised for super admin in attempt to generate widget's content:
caused by: 55a6a33
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1564986
@miq-bot add-label bug, core, rbac