Pearl1594 opened a new pull request #4822:
URL: https://github.com/apache/cloudstack/pull/4822


   ### Description
   
   This PR ensures to list the projects owners in the order in which they were 
added.
   
   ### Types of changes
   
   - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
   - [ ] New feature (non-breaking change which adds functionality)
   - [X] Bug fix (non-breaking change which fixes an issue)
   - [ ] Enhancement (improves an existing feature and functionality)
   - [X] Cleanup (Code refactoring and cleanup, that may add test cases)
   
   ### Feature/Enhancement Scale or Bug Severity
   #### Bug Severity
   
   - [ ] BLOCKER
   - [ ] Critical
   - [ ] Major
   - [ ] Minor
   - [X] Trivial
   
   
   ### Screenshots (if appropriate):
   
   
   ### How Has This Been Tested?
   Prior to fix, listing projects didn't necessarily return a list of project 
owners in the order in which they were added. 
   ```
   Added an account (ACSUser)
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "ACSUser"
           }
         ]
       }
     ]
   }
   
   Added Admin account
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "admin"
           },
           {
             "account": "ACSUser"
           }
         ]
       }
     ]
   }
   
   Added user (u1)
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "ACSUser"
           },
           {
             "account": "admin"
           },
           {
             "account": "u1",
             "user": "u1",
             "userid": "603d77db-bd46-4f06-9c71-18ccd0211f8d"
           }
         ]
       }
     ]
   }
   ```
   Notice that the order of the account/user admins of a project is not the 
same as the order in which they were added to the project
   With this fix, the order of the owners in maintained.
   ```
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "ACSUser"
           }
         ]
       }
     ]
   }
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "ACSUser"
           },
           {
             "account": "admin"
           }
         ]
       }
     ]
   }
   (admin) SBCM5> > list projects listall=true filter=owner,id,name,
   {
     "count": 1,
     "project": [
       {
         "id": "a81b8ec4-fa61-4e17-9383-1083276c18df",
         "name": "p1",
         "owner": [
           {
             "account": "ACSUser"
           },
           {
             "account": "admin"
           },
           {
             "account": "u1",
             "user": "u1",
             "userid": "603d77db-bd46-4f06-9c71-18ccd0211f8d"
           }
         ]
       }
     ]
   }
   
   ```
   
   <!-- Please read the 
[CONTRIBUTING](https://github.com/apache/cloudstack/blob/master/CONTRIBUTING.md)
 document -->
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to