Skip to content

ui: link account to LDAP - #13950

Open
DaanHoogland wants to merge 4 commits into
mainfrom
ghi11473-link-account-to-ldap-ui
Open

DaanHoogland wants to merge 4 commits into
mainfrom
ghi11473-link-account-to-ldap-ui

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR...

Fixes: #11473

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?

@DaanHoogland DaanHoogland added this to the 4.24.0 milestone Aug 22, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

@codecov

codecov Bot commented Aug 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 19.89%. Comparing base (5e5ae0c) to head (d9ca026).
⚠️ Report is 91 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main   #13950      +/-   ##
============================================
+ Coverage     19.72%   19.89%   +0.16%     
- Complexity    19941    20143     +202     
============================================
  Files          6371     6371              
  Lines        575738   576834    +1096     
  Branches      70471    70629     +158     
============================================
+ Hits         113582   114778    +1196     
+ Misses       449810   449511     -299     
- Partials      12346    12545     +199     
Flag Coverage Δ
uitests 3.71% <ø> (+0.29%) ⬆️
unittests 21.16% <ø> (+0.16%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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/13950 (QA-JID-980)

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

🔴 Test Coverage Grade: D — Marginal

Metric Value
Line coverage 24.81%
Branch coverage 19.01%

Grade Scale

Grade Line Coverage Meaning
🟢 A ≥ 80% Excellent - this code sleeps well at night 😴
🟡 B 60-79% Good - almost there, don't stop now 😉
🟠 C 40-59% Acceptable - your code is wearing a seatbelt, but no airbags 😬
🔴 D 20-39% Marginal - boldly shipping where no test has gone before 🖖
⛔ F < 20% Failing - tests? what tests? 🔥

Branch coverage is shown as a secondary signal. Grade is determined by line coverage.
View full Actions run

@DaanHoogland DaanHoogland moved this from Backlog to Ready in CloudStack Testing Aug 31, 2026
@sudo87 sudo87 moved this from Ready to In progress in CloudStack Testing Sep 7, 2026
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

lgtm, tested with openldap locally.
...
2. No option to unlink the account

I believe this is a separate feature (also requested in some issue)

@DaanHoogland DaanHoogland removed their assignment Sep 7, 2026

@sudo87 sudo87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, tested with openldap locally.

few things to note:

  1. Link action remains active after successful linking to ldap, relink will error out with "Entity already exists" for the same account.
  2. No option to unlink the account

Comment thread ui/src/config/section/account.js Outdated
@DaanHoogland
DaanHoogland marked this pull request as draft September 7, 2026 12:46
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

@blueorangutan

Copy link
Copy Markdown

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

Comment thread ui/public/locales/en.json
"label.adding.user": "Adding User...",
"label.address": "Address",
"label.address.group": "Address group",
"label.admin": "Domain Admin",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

not sure if this will cause issues anywhere else in the UI

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

No, I grep -r’d for it. also some languages have admin and other domain admin. Unused.

@sudo87 sudo87 Sep 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need to revert this removal

Image

@vishesh92 vishesh92 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

clgtm. didn't test.

@DaanHoogland
DaanHoogland marked this pull request as ready for review September 10, 2026 09:33
Copilot AI lite review requested due to automatic review settings September 10, 2026 09:33
@DaanHoogland

Copy link
Copy Markdown
Contributor Author

@sudo87 want to retest?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are consistent with existing UI action patterns, include unit coverage for the new mapping behavior, and appear low-risk given current config usage.

Pull request overview

This PR adds UI support for the linkAccountToLdap API from the Account detail view, and extends the generic Autogen action form to properly render and submit select options provided as { id, description } objects (submitting the id while showing a translated label).

Changes:

  • Add an Account action for linkAccountToLdap, pre-filling domainid and account from the current record.
  • Update AutogenView to display translated select labels when an option has a description, and submit option.id for object options.
  • Add unit test coverage for the new {id, description} mapping behavior and introduce new i18n keys for account types + the new action label.
File summaries
File Description
ui/src/views/AutogenView.vue Render select options using translated description when present; submit id for object-mapped options.
ui/tests/unit/views/AutogenView.spec.js Add a unit test ensuring {id, description} option selections submit the id.
ui/src/config/section/domain.js Switch LDAP link domain accounttype options to {id, description} objects for better UX/i18n.
ui/src/config/section/account.js Add linkAccountToLdap action on Account detail view (LDAP-enabled only) with relevant mappings/options.
ui/public/locales/en.json Add new label keys for account types and “Link account to LDAP”; remove unused label.admin.
ui/public/locales/ar.json Add account type label keys; remove unused label.admin.
ui/public/locales/ca.json Add account type label keys; remove unused label.admin.
ui/public/locales/de_DE.json Add account type label keys; remove unused label.admin.
ui/public/locales/el_GR.json Add account type label keys; remove unused label.admin.
ui/public/locales/es.json Add account type label keys; remove unused label.admin.
ui/public/locales/fr_FR.json Add account type label keys; remove unused label.admin.
ui/public/locales/hi.json Add account type label keys; remove unused label.admin.
ui/public/locales/hu.json Add account type label keys; remove unused label.admin.
ui/public/locales/it_IT.json Add account type label keys; remove unused label.admin.
ui/public/locales/ja_JP.json Add account type label keys; remove unused label.admin.
ui/public/locales/ko_KR.json Add account type label keys; remove unused label.admin.
ui/public/locales/nb_NO.json Add account type label keys; remove unused label.admin.
ui/public/locales/nl_NL.json Add account type label keys; remove unused label.admin.
ui/public/locales/pl.json Add account type label keys; remove unused label.admin.
ui/public/locales/pt_BR.json Add account type label keys; remove unused label.admin.
ui/public/locales/ru_RU.json Add account type label keys; remove unused label.admin.
ui/public/locales/te.json Add account type label keys; remove unused label.admin.
ui/public/locales/zh_CN.json Add account type label keys; remove unused label.admin.
Review details
  • Files reviewed: 23/23 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@sudo87 sudo87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • Link Account to LDap works, however "admin" label needs to restored.
  • Link Domain to LDap from UI is broken

Comment thread ui/public/locales/en.json
"label.adding.user": "Adding User...",
"label.address": "Address",
"label.address.group": "Address group",
"label.admin": "Domain Admin",

@sudo87 sudo87 Sep 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

need to revert this removal

Image

},
accounttype: {
options: ['0', '2']
options: [

@sudo87 sudo87 Sep 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this breaks the "Link Domain to Ldap" form, it wont work due to this change.

Screenshot 2026-09-10 at 4 18 11 PM

Copilot AI review requested due to automatic review settings September 11, 2026 11:55
@vishesh92

Copy link
Copy Markdown
Member

@blueorangutan ui

@blueorangutan

Copy link
Copy Markdown

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Address authorization, parameter validation, and missing locale-label issues.

Review details

Suppressed comments (4)

Previously missed (2) — in code that hasn't changed since the last review.

ui/src/config/section/account.js:142

  • Both accounttype and roleid are optional in the API metadata, so this form can be submitted with neither value selected, but the backend explicitly rejects that combination (Either account type or role ID must be given). Add cross-field validation or provide a valid default before allowing submission.
    ui/src/config/section/account.js:151
  • type is optional in the API metadata, so the generic form does not require a selection and omits it when this field is left blank. However, LdapManagerImpl.linkAccountToLdap rejects a null type before processing the request, so the new action can fail with its default/blank state; supply the documented GROUP default (or make the field required) in this action.

ui/src/config/section/account.js:131

  • linkAccountToLdap is authorized only for Admin and DomainAdmin (plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/api/command/LinkAccountToLdapCmd.java:46-47), but this predicate exposes the action to every role whenever LDAP is enabled. A regular user can therefore open a form that will always be rejected by the API; gate the UI action on the same roles while retaining the server-side authorization.
      show: (record, store) => {
        return store.isLdapEnabled

ui/src/config/section/account.js:127

  • This new label key is only defined in en.json, while all supported locale files already carry the corresponding domain-link label. In a non-English UI, this action therefore falls back to English instead of being localized; please add label.link.account.to.ldap to every locale file as well.
      label: 'label.link.account.to.ldap',
  • Files reviewed: 24/24 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@sudo87 sudo87 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm, re-tested the flow.

@blueorangutan

Copy link
Copy Markdown

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

@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

UI : Support linkAccountToLdap from Account Page

5 participants