You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by "bernardodemarco (via GitHub)" <gi...@apache.org> on 2024/12/16 22:22:20 UTC

[PR] List users by their authentication source [cloudstack]

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

   ### Description
   
   Currently, the `listUsers` API response supports the `usersource` attribute, which represents the authentication source of users, such as `native`, `ldap`, `saml2` and `saml2disabled`.  However, it is neither possible to filter users by their authentication source nor to view this attribute in the users' list view.
   
   Therefore, this PR proposes to extend the `listUsers` API by introducing a new parameter called `usersource`, allowing callers to filter users by their authentication source. Furthermore, the UI has been enhanced to support this parameter in the search view and display the `usersource` attribute in the users' list view.
   
   ---
   
   Fixes #9932
   
   ### 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)
   - [X] 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
   - [X] Minor
   
   ### Screenshots (if appropriate):
   
   ![image](https://github.com/user-attachments/assets/891fee58-e59b-4bbe-ab8d-035b5ae7af4a)
   
   ![image](https://github.com/user-attachments/assets/3b8495b6-18a9-4456-8dc3-a44439274546)
   
   ### How Has This Been Tested?
   
   #### Through CloudMonkey
   - Verified that all users are listed when the `usersource` parameter is omitted.
   
   <details>
   <summary>
   <code>list users listall=true filter=account,username,usersource</code>
   </summary>
   
   ```bash
   (localcloud) 🐹 > list users listall=true filter=account,username,usersource
   {
     "count": 9,
     "user": [
       {
         "account": "admin",
         "username": "admin",
         "usersource": "native"
       },
       {
         "account": "baremetal-system-account",
         "username": "baremetal-system-account",
         "usersource": "native"
       },
       {
         "account": "admin",
         "username": "admin-kubeadmin",
         "usersource": "native"
       },
       {
         "account": "euler",
         "username": "euler",
         "usersource": "ldap"
       },
       {
         "account": "tesla",
         "username": "tesla",
         "usersource": "ldap"
       },
       {
         "account": "boyle",
         "username": "boyle",
         "usersource": "ldap"
       },
       {
         "account": "gauss",
         "username": "gauss",
         "usersource": "ldap"
       },
       {
         "account": "saml-u1",
         "username": "saml-u1",
         "usersource": "saml2"
       },
       {
         "account": "saml-u2",
         "username": "saml-u2",
         "usersource": "saml2"
       }
     ]
   }
   ```
   </details>
   
   - Verified that users are listed according to their source when the `usersource` parameter is specified. 
   
   <details>
   <summary>
   <code>list users listall=true filter=account,username,usersource usersource="ldap"</code>
   </summary>
   
   ```bash
   (localcloud) 🐲 > list users listall=true filter=account,username,usersource usersource="ldap"
   {
     "count": 4,
     "user": [
       {
         "account": "euler",
         "username": "euler",
         "usersource": "ldap"
       },
       {
         "account": "tesla",
         "username": "tesla",
         "usersource": "ldap"
       },
       {
         "account": "boyle",
         "username": "boyle",
         "usersource": "ldap"
       },
       {
         "account": "gauss",
         "username": "gauss",
         "usersource": "ldap"
       }
     ]
   }
   ```
   </details>
   
   - Verified that an error message is thrown when the `usersource` value is invalid.
   
   <details>
   <summary>
   <code>list users listall=true filter=account,username,usersource usersource="notValid"</code>
   </summary>
   
   ```bash
   (localcloud) πŸ„ > list users listall=true filter=account,username,usersource usersource="notValid"
   πŸ™ˆ Error: (HTTP 431, error code 4350) Invalid user source: notValid. Valid values are: native, ldap, saml2 and saml2disabled.
   ```
   
   </details>
   
   #### Through UI
   
   - Verified that the `usersource` is displayed in the users' list view:
   
   ![image](https://github.com/user-attachments/assets/891fee58-e59b-4bbe-ab8d-035b5ae7af4a)
   
   - Verified that the `usersource` search filter works as expected:
   
   ![image](https://github.com/user-attachments/assets/3b8495b6-18a9-4456-8dc3-a44439274546)
   


-- 
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] List users by their authentication source [cloudstack]

Posted by "JoaoJandre (via GitHub)" <gi...@apache.org>.
JoaoJandre commented on code in PR #10115:
URL: https://github.com/apache/cloudstack/pull/10115#discussion_r1890355673


##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -827,6 +829,10 @@ private Pair<List<UserAccountJoinVO>, Integer> getUserListInternal(Account calle
             }
         }
 
+        if (userSource != null) {
+            sc.setParameters("userSource", userSource.toString());
+        }

Review Comment:
   We could use setParametersIfNotNull() here



-- 
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] List users by their authentication source [cloudstack]

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

   Packaging result [SF]: βœ”οΈ el8 βœ”οΈ el9 βœ”οΈ debian βœ”οΈ suse15. SL-JID 11823


-- 
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] List users by their authentication source [cloudstack]

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

   @blueorangutan package


-- 
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] List users by their authentication source [cloudstack]

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

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


-- 
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] List users by their authentication source [cloudstack]

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

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


-- 
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] List users by their authentication source [cloudstack]

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

   @blueorangutan package


-- 
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] List users by their authentication source [cloudstack]

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

   Packaging result [SF]: βœ”οΈ el8 βœ”οΈ el9 βœ”οΈ debian βœ”οΈ suse15. SL-JID 11846


-- 
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] List users by their authentication source [cloudstack]

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

   ## [Codecov](https://app.codecov.io/gh/apache/cloudstack/pull/10115?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   All modified and coverable lines are covered by tests :white_check_mark:
   > Project coverage is 4.01%. Comparing base [(`91ab67c`)](https://app.codecov.io/gh/apache/cloudstack/commit/91ab67c9522326217fdef34631d15c697a7c9de6?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) to head [(`de6637d`)](https://app.codecov.io/gh/apache/cloudstack/commit/de6637d1b5b9aa3593af61804083a6d22e57d3cd?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   > Report is 1 commits behind head on main.
   
   > :exclamation:  There is a different number of reports uploaded between BASE (91ab67c) and HEAD (de6637d). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (91ab67c) | HEAD (de6637d) |
   >|------|------|------|
   >|unittests|1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   ```diff
   @@              Coverage Diff              @@
   ##               main   #10115       +/-   ##
   =============================================
   - Coverage     16.06%    4.01%   -12.05%     
   =============================================
     Files          5642      394     -5248     
     Lines        493856    32378   -461478     
     Branches      59860     5716    -54144     
   =============================================
   - Hits          79326     1301    -78025     
   + Misses       405749    30929   -374820     
   + Partials       8781      148     -8633     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/cloudstack/pull/10115/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/10115/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `4.01% <ΓΈ> (-0.01%)` | :arrow_down: |
   | [unittests](https://app.codecov.io/gh/apache/cloudstack/pull/10115/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 Sentry](https://app.codecov.io/gh/apache/cloudstack/pull/10115?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).
   


-- 
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] List users by their authentication source [cloudstack]

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

   > On the initial saml user creation, the user type is created as Native only on the refresh of the page the usertype changes to SAML
   
   @kiranchavala, thanks for testing. The bug should be resolved now. Could you please test it again and confirm?


-- 
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] List users by their authentication source [cloudstack]

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

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


-- 
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] List users by their authentication source [cloudstack]

Posted by "DaanHoogland (via GitHub)" <gi...@apache.org>.
DaanHoogland merged PR #10115:
URL: https://github.com/apache/cloudstack/pull/10115


-- 
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] List users by their authentication source [cloudstack]

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

   > > On the initial saml user creation, the user type is created as Native only on the refresh of the page the usertype changes to SAML
   > 
   > @kiranchavala, thanks for testing. The bug should be resolved now. Could you please test it again and confirm?
   
   Thanks @bernardodemarco Issue is resolved


-- 
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] List users by their authentication source [cloudstack]

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

   @blueorangutan test keepEnv


-- 
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] List users by their authentication source [cloudstack]

Posted by "bernardodemarco (via GitHub)" <gi...@apache.org>.
bernardodemarco commented on code in PR #10115:
URL: https://github.com/apache/cloudstack/pull/10115#discussion_r1890985082


##########
server/src/main/java/com/cloud/api/query/QueryManagerImpl.java:
##########
@@ -827,6 +829,10 @@ private Pair<List<UserAccountJoinVO>, Integer> getUserListInternal(Account calle
             }
         }
 
+        if (userSource != null) {
+            sc.setParameters("userSource", userSource.toString());
+        }

Review Comment:
   If the `setParametersIfNotNull` method were used, scenarios where `userSource` is `null` would result in an NPE because the `toString` method of the enum is invoked.



-- 
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] List users by their authentication source [cloudstack]

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

   <b>[SF] Trillian test result (tid-11926)</b>
   Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
   Total time taken: 60615 seconds
   Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10115-t11926-kvm-ol8.zip
   Smoke tests completed. 140 look OK, 1 have errors, 0 did not run
   Only failed and skipped tests results shown below:
   
   
   Test | Result | Time (s) | Test File
   --- | --- | --- | ---
   test_01_redundant_vpc_site2site_vpn | `Failure` | 459.49 | test_vpc_vpn.py
   


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