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

Disable Look up Group for Amazon, Database and External with SAML #3881

Merged
merged 2 commits into from
May 9, 2018

Conversation

ZitaNemeckova
Copy link
Contributor

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1440209

Instructions from BZ:

Group lookup is not supported when using external authentication with SAML.
Group lookup is also not supported for Amazon.

How to reproduce:
Configuration -> Settings -> select Current Server -> Authentication -> Mode -> set to Amazon/Database/External with SAML enabled
Configuration -> Access Control -> Create a new Group
Before:
screen shot 2018-05-02 at 2 04 28 pm
screen shot 2018-05-02 at 2 31 15 pm

After:
screen shot 2018-05-02 at 2 05 14 pm

@miq-bot add_label bug, gaprindashvili/yes, fine/yes, euwe/yes

Copy link
Member

@jvlcek jvlcek left a comment

Choose a reason for hiding this comment

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

Just this one suggestion.

@@ -1,6 +1,9 @@
- if @edit
- url = url_for_only_path(:action => 'rbac_group_field_changed', :id => (@edit[:group_id] || "new"))
- combo_url = "/ops/rbac_group_field_changed/#{@edit[:group_id] || 'new'}"
- amazon_authentication = ::Settings.authentication.mode.casecmp('amazon') == 0
- database_authentication = ::Settings.authentication.mode.casecmp('database') == 0
- ext_auth_with_saml = ::Settings.authentication.mode.casecmp("httpd") == 0 && ::Settings.authentication.saml_enabled
Copy link
Member

Choose a reason for hiding this comment

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

@ZitaNemeckova Thank you for putting this together.

I have a suggestion that might simplify the code.

Group lookup is only supported when:

  1. mode is either ldap or ldaps
  2. mode is httpd and saml is not enabled

So maybe something like this ruby-ish pseudo code would be better:

mode = ::Settings.authentication.mode
saml_enabled = ::Settings.authentication.saml_enabled
can_lookup_groups = false
can_lookup_groups = mode.downcase.start_with?('ldap')
can_lookup_groups = mode.downcase == "httpd" && ! saml_enabled unless can_lookup_groups

Then the check below changes from:

- if !amazon_authentication && !database_authentication && !ext_auth_with_saml
+ if can_lookup_groups

Hope this helps! JoeV

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jvlcek Thanks, looks way better 👍

For Amazon and external authentication with SAML do not show "Look up groups" checkbox
@miq-bot
Copy link
Member

miq-bot commented May 3, 2018

Checked commits ZitaNemeckova/manageiq-ui-classic@7f63e7b~...355c99c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
1 file checked, 0 offenses detected
Everything looks fine. 👍

@jvlcek
Copy link
Member

jvlcek commented May 3, 2018

👍 Nice @ZitaNemeckova Thank you. LGTM

@ZitaNemeckova
Copy link
Contributor Author

@mzazrivec please review/merge, thanks :)

@mzazrivec mzazrivec self-assigned this May 9, 2018
@mzazrivec mzazrivec added this to the Sprint 86 Ending May 21, 2018 milestone May 9, 2018
@mzazrivec mzazrivec merged commit 7ff1402 into ManageIQ:master May 9, 2018
@ZitaNemeckova ZitaNemeckova deleted the fix_group_lookup branch May 9, 2018 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants