You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "stag7824 (via GitHub)" <gi...@apache.org> on 2026/09/11 11:59:30 UTC

[PR] ui: keep the console loading when a role denies listLdapConfigurations [cloudstack]

stag7824 opened a new pull request, #14152:
URL: https://github.com/apache/cloudstack/pull/14152

   ### Description
   
   Fixes #13912
   
   A role that denies `listLdapConfigurations` cannot use the web console at all: the UI never
   renders and the user is redirected back to `/user/login`.
   
   `GetInfo` in `ui/src/store/modules/user.js` runs about a dozen independent bootstrap calls
   inside a single `new Promise`, and several of them are wired to that one shared `reject`.
   `listLdapConfigurations` is one of them, and all it does with the answer is record a flag:
   
   ```js
   getAPI('listLdapConfigurations').then(response => {
     const ldapEnable = (response.ldapconfigurationresponse.count > 0)
     commit('SET_LDAP', ldapEnable)
   }).catch(error => {
     reject(error)
   })
   ```
   
   When the role denies it, the 432 rejects the shared promise. That is a race against
   `listApis` resolving it, and the tiny denied query almost always settles first, so `GetInfo`
   rejects. The router guard in `ui/src/permission.js` treats a rejected `GetInfo` as a failed
   session and logs the user out instead of building routes — so one denied flag read takes down
   the whole console.
   
   The tolerant pattern is already in the same function, a few lines away.
   `listNetworkServiceProviders` and `cloudianIsEnabled` both swallow their own error and the
   console loads fine without them. This change gives `listLdapConfigurations` the same
   treatment, defaulting the flag rather than rejecting:
   
   ```js
   }).catch(ignored => {
     // A role is allowed to deny this read. It only records whether LDAP is configured, so
     // treat it as not configured rather than rejecting the promise the whole console waits on.
     commit('SET_LDAP', false)
   })
   ```
   
   Defaulting to `false` matches what the flag already means elsewhere — `Logout` resets it, and
   a denied read is not evidence that LDAP is configured.
   
   #### Scope
   
   I have deliberately changed only the call named in the issue. `listCapabilities`, `listZones`
   and the second `listUsers` are wired to the same shared `reject` and carry the same hazard,
   but unlike this one they are not pure flag reads, so whether each is "essential" is a call for
   you rather than for me. Happy to widen this PR if you'd like them handled together, or to
   leave that to a follow-up.
   
   ### Types of changes
   
   - [x] Bug fix (non-breaking change which fixes an issue)
   
   ### Feature/Enhancement Scale or Bug Severity
   
   #### Bug Severity
   
   - [x] Major
   
   ### How Has This Been Tested?
   
   I could not add a unit test for this proportionately: `user.js` imports `@/router`, `@/store`
   and `@/vue-app`, there are no existing tests for any store module to build on, and standing
   that scaffolding up for a three-line change seemed like more maintenance burden than it is
   worth. Happy to add one if you disagree.
   
   What I did instead was reduce `GetInfo`'s promise structure to a runnable model — a late
   `listApis` that resolves, a tolerant denied call, and the denied `listLdapConfigurations` —
   and run it both ways:
   
   ```
   without the fix  -> LOGGED OUT      (432 denied by role)
   with the fix     -> console loads   (apis=1, ldap=false)
   ```
   
   which reproduces the reported behaviour and the race described in the issue: the small denied
   query settles before `listApis` can resolve the shared promise.
   
   I also ran what CI runs, on Node 16 to match `.github/workflows/ui.yml`:
   
   ```
   npm run lint       DONE  No lint errors found!
   npm run test:unit  Test Suites: 9 passed, 9 total
                      Tests:       191 passed, 191 total
   ```
   
   `vue-cli-service lint` autofixes by default, so I checked separately that it left the file
   untouched rather than quietly reformatting the change into shape.
   
   I do not have a deployment with custom roles to confirm the console rendering end to end, so
   that part is unverified by me. The change itself is the same shape as the two tolerant calls
   either side of it.
   
   The same construction is present on 4.20 (it uses `api(` rather than `getAPI(` there). I have
   targeted 4.22 since that is what the issue names, but happy to retarget.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ui: keep the console loading when a role denies listLdapConfigurations [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland commented on PR #14152:
URL: https://github.com/apache/cloudstack/pull/14152#issuecomment-6264877836

   Thanks for you patience @stag7824 , I started them now


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ui: keep the console loading when a role denies listLdapConfigurations [cloudstack]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #14152:
URL: https://github.com/apache/cloudstack/pull/14152#issuecomment-6265095391

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/14152?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 4.04%. Comparing base ([`0931cf8`](https://app.codecov.io/gh/apache/cloudstack/commit/0931cf818e6b1e620e158a97164bafbc8e31e0c8?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`dbe3dd2`](https://app.codecov.io/gh/apache/cloudstack/commit/dbe3dd2c6ecf4d97833ba1f45c4ab5191d7e7487?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 7 commits behind head on 4.22.
   > :exclamation:  There is a different number of reports uploaded between BASE (0931cf8) and HEAD (dbe3dd2). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (0931cf8) | HEAD (dbe3dd2) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               4.22   #14152       +/-   ##
   =============================================
   - Coverage     18.02%    4.04%   -13.98%     
   =============================================
     Files          5936      449     -5487     
     Lines        535866    38240   -497626     
     Branches      65614     7082    -58532     
   =============================================
   - Hits          96574     1546    -95028     
   + Misses       428291    36482   -391809     
   + Partials      11001      212    -10789     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/14152/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [uitests](https://app.codecov.io/gh/apache/cloudstack/pull/14152/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.04% <ø> (ø)` | |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/14152/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/cloudstack/pull/14152?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] ui: keep the console loading when a role denies listLdapConfigurations [cloudstack]

Posted by "stag7824 (via GitHub)" <gi...@apache.org>.
stag7824 commented on PR #14152:
URL: https://github.com/apache/cloudstack/pull/14152#issuecomment-6111725325

   A heads-up on CI for this one, in case it saves someone a lookup: none of the workflow runs on the earlier head were ever approved, so they expired after 30 days (all 8 were created on Sep 11 and all failed with no jobs at the same minute today). So this change has never actually been tested.
   
   I've synced the branch with 4.22 (no conflicts, and the diff against 4.22 is still just the 4 lines in `user.js`). The new head `dbe3dd2` has 8 runs waiting for approval. @RosiKyu, could you or another committer approve them when you have a moment? Thanks.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org