Skip to content

isrecursive not honoured for listAccounts, maybe others as well #4868

Closed

Description

@davidjumani
ISSUE TYPE
  • Bug Report
CLOUDSTACK VERSION

4.14 + (maybe even lower versions)

SUMMARY

isrecursive is not honoured when passed along with listall=true for listAccounts as a root admin
It is also not honoured when allow.user.view.all.domain.accounts is true

https://github.com/apache/cloudstack/blob/master/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java#L2198-L2205

EXPECTED RESULTS
(qa) 🐱 > list accounts filter=name,domain domainid=e4874e10-5fdf-11ea-9a56-1e006800018c listall=true isrecursive=false 
{
  "account": [
    {
      "domain": "ROOT",
      "name": "admin"
    },
    {
      "domain": "ROOT",
      "name": "baremetal-system-account"
    },
    ................

ACTUAL RESULTS
(qa) 🐱 > list accounts filter=name,domain domainid=e4874e10-5fdf-11ea-9a56-1e006800018c listall=true isrecursive=false 
{
  "account": [
    {
      "domain": "ROOT",
      "name": "admin"
    },
    {
      "domain": "ROOT",
      "name": "baremetal-system-account"
    },
    {
      "domain": "small",            <- from a sub domain
      "name": "rick"
    },

Activity

  1. DaanHoogland commented on Mar 25, 2021

    @DaanHoogland
    Contributor

    so basically teh defined functionalities of listall and isrecursive overlap and listall prefails. iniutitively I'd say isrecursive should prefail, so FWIW I agree.

  2. added this to the 4.14.2.0 milestone on Mar 25, 2021
  3. ravening commented on Apr 1, 2021

    @ravening
    Member

    @davidjumani @DaanHoogland this issue exists for several api's if you call the api from the child domain

    I have seen the same issue for listing service offering and disk offering as well. I have created a pr for it

    Create the following domain relationship

    ROOT -> test1 -> test11

    Now login as test1 and create a service offering for test11 domain.
    If you login as test11, you wont see it

  4. DaanHoogland commented on Apr 2, 2021

    @DaanHoogland
    Contributor

    @davidjumani @DaanHoogland this issue exists for several api's if you call the api from the child domain

    I have seen the same issue for listing service offering and disk offering as well. I have created a pr for it

    Create the following domain relationship

    ROOT -> test1 -> test11

    Now login as test1 and create a service offering for test11 domain.
    If you login as test11, you wont see it

    @ravening that sounds more like a problem with access than recursion, wouldn't you say so?

  5. ravening commented on Apr 2, 2021

    @ravening
    Member

    Not with recursion but how the code works

  6. DaanHoogland commented on Apr 2, 2021

    @DaanHoogland
    Contributor

    yes, well, domains have a concept of recursion but accounts do not. In the zone/pod/cluster/host there is another form of what could be called recursion. What you name above seems like a bug to me, but in general it is hard to define recursion consistently in cloudstack behaviour when it comes to these constructs.

    Not with recursion but how the code works

    Do you agree with how @davidjumani proposes to implement this?
    And do you have other examples where it should behave the same?

    I think what you mention about creating a service offering merits an issue ticket of its own.

  7. davidjumani commented on Apr 6, 2021

    @davidjumani
    ContributorAuthor

    I think that this is a deeper issue that could be across several elements. Need to look into whether this should be fixed. I personally think so and can raise a PR for the same but would like to get a wider feedback

  8. modified the milestones: 4.14.2.0, 4.15.2.0 on May 25, 2021
  9. nvazquez commented on Aug 2, 2021

    @nvazquez
    Contributor

    @davidjumani reading the description of the parameters:

    • listall: If set to false, list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false
    • isrecursive: defaults to false, but if true, lists all resources from the parent specified by the domainId till leaves.

    Seems like these definitions might need a change, have you thought about a new behaviour?

  10. davidjumani commented on Aug 2, 2021

    @davidjumani
    ContributorAuthor

    @nvazquez Not just the definitions but the implementations as well

  11. nvazquez commented on Aug 2, 2021

    @nvazquez
    Contributor

    @davidjumani sure, my question was if you could explain what's your idea on the new implementation. Maybe easier to explain the new definitions of both parameter

  12. davidjumani commented on Aug 3, 2021

    @davidjumani
    ContributorAuthor

    @nvazquez My idea is :

    • listall : Returns all resources the user can access. As of now when set to true, it fetches resources recursively even if isrecursive is set to false. Change it to respect isrecursive
    • isrecursive : Leave it as is
  13. 13 remaining items

  14. moved this to Dev In Progress in Apache CloudStack 4.17.0on Feb 7, 2022
  15. Repository owner moved this from Dev In Progress to Done in Apache CloudStack 4.17.0on Mar 11, 2022
  16. yadvr commented on Mar 24, 2022

    @yadvr
    Member

    It appears David's PR was reverted. @nvazquez pl review with 4.17 team if this is worth fixing for 4.17, or move to next milestone(s).

  17. reopened this on Mar 24, 2022
  18. Repository owner moved this from Done to Information Requested in Apache CloudStack 4.17.0on Mar 24, 2022
  19. nvazquez commented on Mar 25, 2022

    @nvazquez
    Contributor

    Thanks @rohityadavcloud we have forgotten to reopen this issue after reverting the PR, moving it to the next milestone

  20. modified the milestones: 4.17.0.0, 4.18.0.0 on Mar 25, 2022
  21. modified the milestones: 4.18.0.0, 4.17.1.0 on Apr 20, 2022
  22. davidjumani commented on Aug 18, 2022

    @davidjumani
    ContributorAuthor

    This is a niche case and not frequently encountered. Can reopen when required

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions