Skip to content

unlink an ldap domain - #11962

Merged
DaanHoogland merged 12 commits into
apache:mainfrom
shapeblue:ghi3685-unlinkLdap
Dec 17, 2025
Merged

unlink an ldap domain#11962
DaanHoogland merged 12 commits into
apache:mainfrom
shapeblue:ghi3685-unlinkLdap

Conversation

@DaanHoogland

Copy link
Copy Markdown
Contributor

Description

This PR

Fixes: #3685 partially as unlinking an account has no good functional definition (yet)
Fixes: #11474 by removing a long time deprecated parameter

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?

@codecov

codecovBot commented Nov 3, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 6.06061% with 31 lines in your changes missing coverage. Please review.
✅ Project coverage is 17.48%. Comparing base (f06ac51) to head (9c68433).
⚠️ Report is 2 commits behind head on main.

Files with missing linesPatch %Lines
...loudstack/api/command/UnlinkDomainFromLdapCmd.java0.00%16 Missing ⚠️
...va/org/apache/cloudstack/ldap/LdapManagerImpl.java0.00%13 Missing ⚠️
...he/cloudstack/api/command/LinkDomainToLdapCmd.java33.33%2 Missing ⚠️
Additional details and impacted files
@@ Coverage Diff @@## main #11962 +/- ##
============================================
- Coverage 17.48% 17.48% -0.01% - Complexity 15552 15554 +2 
============================================
Files 5913 5914 +1 Lines 529650 529678 +28 Branches 64716 64718 +2 ============================================
+ Hits 92629 92633 +4 - Misses 426576 426601 +25 + Partials 10445 10444 -1 
FlagCoverage Δ
uitests3.58% <ø> (-0.01%)⬇️
unittests18.55% <6.06%> (-0.01%)⬇️

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.

CopilotAI 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.

Pull Request Overview

This PR adds functionality to unlink a CloudStack domain from LDAP, complementing the existing linkDomainToLdap functionality. The changes also include refactoring improvements to clean up the LinkDomainToLdapCmd by removing deprecated parameters and improving logging.

Key Changes

  • Added new unlinkDomainFromLdap API command to remove domain-to-LDAP linkages
  • Removed deprecated name parameter and improved the LinkDomainToLdapCmd implementation
  • Applied minor code modernization (diamond operator, parametrized logging)

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
FileDescription
UnlinkDomainFromLdapCmd.javaNew API command for unlinking domains from LDAP
LdapManager.javaAdded interface method for unlinking and removed trailing semicolon from enum
LdapManagerImpl.javaImplemented unlinkDomainFromLdap method and applied diamond operator refactoring
LinkDomainToLdapCmd.javaRemoved deprecated name parameter, made ldapDomain required, and improved logging
pom.xmlAdded explicit cloud-api dependency
Comments suppressed due to low confidence (1)

plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java:308

  • The new UnlinkDomainFromLdapCmd class is not registered in the getCommands() list, which means it won't be available as an API command. Add cmdList.add(UnlinkDomainFromLdapCmd.class); before the return statement.
 final List<Class<?>> cmdList = new ArrayList<>();
cmdList.add(LdapUserSearchCmd.class);
cmdList.add(LdapListUsersCmd.class);
cmdList.add(LdapAddConfigurationCmd.class);
cmdList.add(LdapDeleteConfigurationCmd.class);
cmdList.add(LdapListConfigurationCmd.class);
cmdList.add(LdapCreateAccountCmd.class);
cmdList.add(LdapImportUsersCmd.class);
cmdList.add(LDAPConfigCmd.class);
cmdList.add(LDAPRemoveCmd.class);
cmdList.add(LinkDomainToLdapCmd.class);
cmdList.add(LinkAccountToLdapCmd.class);
return cmdList;

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

Comment threadplugins/user-authenticators/ldap/pom.xml

@shwstpprshwstppr 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.

some comments, idea looks good. Will need testing

Comment threadplugins/user-authenticators/ldap/pom.xml Outdated

@vishesh92vishesh92 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.

Code looks good to me. Just one change is required.

@kiranchavalakiranchavala 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.

@DaanHoogland

(localcloud) 🐱 > link domaintoldap domainid=0735d7e8-5dcc-4b48-8049-81c69d8830d3 type=GROUP accounttype=2 ldapdomain=cn=qa-team,ou=Telco-Bng,dc=example,dc=in name=qa admin=admin
{
"LinkDomainToLdap": {
"accounttype": 2,
"domainid": "0735d7e8-5dcc-4b48-8049-81c69d8830d3",
"ldapdomain": "cn=qa-team,ou=Telco-Bng,dc=example,dc=in",
"name": "cn=qa-team,ou=Telco-Bng,dc=example,dc=in",
"type": "GROUP"
}
}
mysql> select * from ldap_configuration;
+----+-----------+------+-----------+--------------------------------------+
| id | hostname | port | domain_id | uuid |
+----+-----------+------+-----------+--------------------------------------+
| 2 | localhost | 389 | 2 | e07853d9-73dc-4486-9acf-66937c8123a5 |
+----+-----------+------+-----------+--------------------------------------+
1 row in set (0.00 sec)
mysql> select * from ldap_trust_map;
+----+-----------+-------+------------------------------------------+--------------+------------+
| id | domain_id | type | name | account_type | account_id |
+----+-----------+-------+------------------------------------------+--------------+------------+
| 1 | 2 | GROUP | cn=qa-team,ou=Telco-Bng,dc=example,dc=in | 2 | 0 |
+----+-----------+-------+------------------------------------------+--------------+------------+
1 row in set (0.00 sec)

Getting the following response from the api , but the entry is deleted from the database

(localcloud) 🐱 > unlink domainfromldap domainid=0735d7e8-5dcc-4b48-8049-81c69d8830d3
🙈 Error: failed to decode response
mysql> select * from ldap_trust_map;
Empty set (0.00 sec)

Also the UI progress doesn't stop when a user tried to link domain to ldap

Screenshot 2025-11-05 at 5 22 05 PM

@DaanHoogland

Copy link
Copy Markdown
ContributorAuthor

@kiranchavala , those issues are fixed, however there are some polish issues remaining, like the condition to enable link or unlink are not available in the UI atm and I need to decide/discuss how to address these.

@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@apacheapache deleted a comment from blueorangutanNov 5, 2025
@rajujith

Copy link
Copy Markdown
Contributor

@DaanHoogland, there is a similar use case with accounts where there are no UI options https://cloudstack.apache.org/api/apidocs-4.20/apis/linkAccountToLdap.html. Should this also be considered in this PR?

@kiranchavala

Copy link
Copy Markdown
Member

@DaanHoogland, there is a similar use case with accounts where there are no UI options https://cloudstack.apache.org/api/apidocs-4.20/apis/linkAccountToLdap.html. Should this also be considered in this PR?

Yes @rajujith@DaanHoogland

The improvement issue is already present

#11473

@DaanHoogland

Copy link
Copy Markdown
ContributorAuthor

@DaanHoogland, there is a similar use case with accounts where there are no UI options https://cloudstack.apache.org/api/apidocs-4.20/apis/linkAccountToLdap.html. Should this also be considered in this PR?

Yes @rajujith@DaanHoogland

The improvement issue is already present

#11473

guys (@rajujith@kiranchavala), I don’t want to add and create a big beautiful PR. I’d rather implement smaller well tested changes, if you don’t mind. We need to have a backend change in DomainResponse as well to be able to decide whether to show the link or the unlink button. I am sure we will find more issues while working on this.

@Pearl1594Pearl1594 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.

Linking and unlinking of domain to ldap works fine, however, as an improvement to this it would be nice to selectively show and hide the link/unlink buttons based on whether the domain is linked to an LDAP or not. But that could happen on a separate PR> Also, ldapdomain requires translation
image

@DaanHooglandDaanHoogland added this to the 4.23 milestone Dec 8, 2025
@apacheapache deleted a comment from blueorangutanDec 8, 2025
@apacheapache deleted a comment from blueorangutanDec 8, 2025
@blueorangutan

Copy link
Copy Markdown

[SF] Trillian Build Failed (tid-14955)

@sureshanapartisureshanaparti 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.

clgtm

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14994)
Environment: kvm-ol9 (x2), zone: Advanced Networking with Mgmt server ol9
Total time taken: 62170 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11962-t14994-kvm-ol9.zip
Smoke tests completed. 146 look OK, 4 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
ContextSuite context=TestClusterDRS>:setupError0.00test_cluster_drs.py
test_list_system_vms_metrics_historyFailure0.19test_metrics_api.py
test_01_deployVMInSharedNetworkFailure265.67test_network.py
ContextSuite context=TestResetVmOnReboot>:setupError0.00test_reset_vm_on_reboot.py

@DaanHoogland

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 16053

@DaanHoogland

Copy link
Copy Markdown
ContributorAuthor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

[SF] Trillian test result (tid-14999)
Environment: kvm-ol8 (x2), zone: Advanced Networking with Mgmt server ol8
Total time taken: 53542 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr11962-t14999-kvm-ol8.zip
Smoke tests completed. 149 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

TestResultTime (s)Test File
test_03_deploy_and_scale_kubernetes_clusterFailure26.87test_kubernetes_clusters.py

@DaanHoogland
DaanHoogland merged commit 124fcde into apache:mainDec 17, 2025
42 of 45 checks passed
@DaanHoogland
DaanHoogland deleted the ghi3685-unlinkLdap branch December 17, 2025 12:04
dhslove pushed a commit to ablecloud-team/ablestack-cloud that referenced this pull request Jan 21, 2026
Co-authored-by: Daan Hoogland <dahn@apache.org>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
sandeeplocharla pushed a commit to NetApp/cloudstack that referenced this pull request Feb 6, 2026
Co-authored-by: Daan Hoogland <dahn@apache.org>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
owsferraro pushed a commit to owsferraro/cloudstack that referenced this pull request Mar 25, 2026
Co-authored-by: Daan Hoogland <dahn@apache.org>
Co-authored-by: Abhishek Kumar <abhishek.mrt22@gmail.com>
Co-authored-by: Suresh Kumar Anaparti <sureshkumar.anaparti@gmail.com>
Sign up for freeto 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.

Api/UI: Update API docs or remove the name or ldapdomain parameter no way to unlink account/domain from ldap

9 participants

@DaanHoogland@rajujith@kiranchavala@blueorangutan@shwstppr@vishesh92@Pearl1594@sureshanaparti