Skip to content

avoid rejecting user login if listLdapConfiguration is not allowed#13152

Open
sudo87 wants to merge 4 commits into
apache:4.20from
shapeblue:skipRejectionLdapConfig
Open

avoid rejecting user login if listLdapConfiguration is not allowed#13152
sudo87 wants to merge 4 commits into
apache:4.20from
shapeblue:skipRejectionLdapConfig

Conversation

@sudo87
Copy link
Copy Markdown
Contributor

@sudo87 sudo87 commented May 13, 2026

Description

This PR fixes the login flow for users who do not have permission to access the listLdapConfigurations API. Currently, login is blocked for these users regardless of whether LDAP is configured.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • Build/CI
  • Test (unit or integration test code)

Feature/Enhancement Scale or Bug Severity

Feature/Enhancement Scale

  • Major
  • Minor

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

Screenshots (if appropriate):

How Has This Been Tested?

How did you try to break this feature and the system with this change?

Copy link
Copy Markdown
Contributor

@sureshanaparti sureshanaparti left a comment

Choose a reason for hiding this comment

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

clgtm

@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan ui

@sureshanaparti sureshanaparti added this to the 4.20.4 milestone May 13, 2026
@blueorangutan
Copy link
Copy Markdown

@sureshanaparti a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the UI login/feature-discovery flow so that a user without permission to call listLdapConfigurations is not blocked from logging in, while still keeping the UI’s LDAP-enabled flag updated when LDAP config changes.

Changes:

  • Stop rejecting the GetInfo flow when listLdapConfigurations fails (e.g., due to missing API permission).
  • Rename the Vuex action used for refreshing the LDAP-enabled flag from UpdateConfiguration to UpdateLdapConfigurationFlag.
  • Update AutogenView to dispatch the renamed action after LDAP configuration add/delete actions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
ui/src/views/AutogenView.vue Dispatches the renamed Vuex action after LDAP config mutations.
ui/src/store/modules/user.js Makes LDAP config listing non-fatal during GetInfo; renames the LDAP refresh action.
Comments suppressed due to low confidence (1)

ui/src/store/modules/user.js:561

  • UpdateLdapConfigurationFlag wraps the API call in a new Promise(...) but never calls resolve(...) on success, so any caller awaiting dispatch('UpdateLdapConfigurationFlag') will hang indefinitely. Either call resolve(ldapEnable) inside the then(...) (and possibly resolve(false) on handled errors), or simplify by returning the api('listLdapConfigurations') promise chain directly.
    UpdateLdapConfigurationFlag ({ commit }) {
      return new Promise((resolve, reject) => {
        api('listLdapConfigurations').then(response => {
          const ldapEnable = (response.ldapconfigurationresponse.count > 0)
          commit('SET_LDAP', ldapEnable)
        }).catch(error => {
          reject(error)
        })
      })

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui/src/store/modules/user.js
@codecov
Copy link
Copy Markdown

codecov Bot commented May 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 16.26%. Comparing base (a7c2a05) to head (4181f74).

Additional details and impacted files
@@             Coverage Diff              @@
##               4.20   #13152      +/-   ##
============================================
- Coverage     16.27%   16.26%   -0.01%     
+ Complexity    13440    13431       -9     
============================================
  Files          5665     5665              
  Lines        500555   500556       +1     
  Branches      60789    60789              
============================================
- Hits          81445    81396      -49     
- Misses       410004   410053      +49     
- Partials       9106     9107       +1     
Flag Coverage Δ
uitests 4.15% <ø> (-0.01%) ⬇️
unittests 17.11% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@blueorangutan
Copy link
Copy Markdown

UI build: ✔️
Live QA URL: https://qa.cloudstack.cloud/simulator/pr/13152 (QA-JID-917)

@andrijapanicsb
Copy link
Copy Markdown
Contributor

I opened a stacked follow-up PR against this PR's source branch with the review hardening from the reproduced 4.22 issue: shapeblue#136

It keeps listLdapConfigurations non-fatal during login, but also resets LDAP state to boolean false, guards missing/ignored responses, resolves UpdateLdapConfigurationFlag, and suppresses the generic optional-discovery 401 notification for this probe.

@andrijapanicsb
Copy link
Copy Markdown
Contributor

Update: I pushed the follow-up hardening directly into this PR branch now that I confirmed write access to shapeblue/cloudstack:skipRejectionLdapConfig.

The PR now includes commit d9b85efc15, which:

  • keeps denied listLdapConfigurations non-fatal during login,
  • resets LDAP state to boolean false instead of {},
  • guards the LDAP count response,
  • resolves UpdateLdapConfigurationFlag on success,
  • suppresses the optional-discovery 401 notification for this probe.

The temporary stacked PR is now merged/superseded: shapeblue#136

@andrijapanicsb
Copy link
Copy Markdown
Contributor

@blueorangutan ui

1 similar comment
@sureshanaparti
Copy link
Copy Markdown
Contributor

@blueorangutan ui

Comment thread ui/src/store/modules/user.js Outdated
Comment thread ui/src/store/modules/user.js Outdated
andrijapanicsb and others added 2 commits May 14, 2026 17:49
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
@andrijapanicsb
Copy link
Copy Markdown
Contributor

@blueorangutan ui

1 similar comment
@nvazquez
Copy link
Copy Markdown
Contributor

@blueorangutan ui

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.

6 participants