rhtyd commented on issue #3894: api: Fix count and item issues returned by list 
APIs
URL: https://github.com/apache/cloudstack/pull/3894#issuecomment-590838404
 
 
   Quick test, for example the listing of ips:
   
   Before: (domain admin sees ips from other projects)
   ```
   (qaprimate) 🐱 > list publicipaddresses  listall=true projectid=-1
   {
     "count": 3,
     "publicipaddress": [
       {
         "allocated": "2020-02-17T16:33:27+0100",
         "associatednetworkid": "0ac48c1b-e2bc-4462-8dfd-cbdb3bd71390",
         "associatednetworkname": "TestUserProjectNetwork",
         "domain": "ROOT",
         "domainid": "fa323836-4f04-11ea-b408-1e006800018c",
         "forvirtualnetwork": true,
         "id": "26e2d0f7-476d-4598-a2c8-4b59d29aaf8e",
         "ipaddress": "192.168.2.195",
         "isportable": false,
         "issourcenat": true,
         "isstaticnat": false,
         "issystem": false,
         "networkid": "ecd874e8-9c14-4a66-8528-c4a11960c7be",
         "physicalnetworkid": "08344756-9abc-41c0-b575-8ca1a0a7c77d",
         "project": "TestUserProject",
         "projectid": "5660c407-167c-480d-9825-5b54d63797b7",
         "state": "Allocated",
         "tags": [],
         "zoneid": "91b49be0-5a8b-4f3e-83b8-3bdfee4eba78",
         "zonename": "Sandbox-simulator"
       },
       {
         "allocated": "2020-02-19T13:32:44+0100",
         "associatednetworkid": "22272dc5-65fb-439e-af3d-c2884f3101c8",
         "associatednetworkname": "SamlUserProjectNet",
         "domain": "ROOT",
         "domainid": "fa323836-4f04-11ea-b408-1e006800018c",
         "forvirtualnetwork": true,
         "id": "3574b63a-5dd9-4d1d-8c79-91de2952203d",
         "ipaddress": "192.168.2.168",
         "isportable": false,
         "issourcenat": true,
         "isstaticnat": false,
         "issystem": false,
         "networkid": "ecd874e8-9c14-4a66-8528-c4a11960c7be",
         "physicalnetworkid": "08344756-9abc-41c0-b575-8ca1a0a7c77d",
         "project": "SamlUserProject",
         "projectid": "879a2fe0-639f-4709-a405-5d145d7625f7",
         "state": "Allocated",
         "tags": [],
         "zoneid": "91b49be0-5a8b-4f3e-83b8-3bdfee4eba78",
         "zonename": "Sandbox-simulator"
       },
       {
         "allocated": "2020-02-25T09:39:16+0100",
         "associatednetworkid": "493824ac-12d5-43c6-b6d6-2246270cf0a0",
         "associatednetworkname": "testdomain-project-net",
         "domain": "Domain",
         "domainid": "d56ba667-945e-46be-8829-e21df75af531",
         "forvirtualnetwork": true,
         "id": "aea77e18-99b8-4a66-8cb5-15e6848134f6",
         "ipaddress": "192.168.2.121",
         "isportable": false,
         "issourcenat": true,
         "isstaticnat": false,
         "issystem": false,
         "networkid": "ecd874e8-9c14-4a66-8528-c4a11960c7be",
         "physicalnetworkid": "08344756-9abc-41c0-b575-8ca1a0a7c77d",
         "project": "DomainAdminProject",
         "projectid": "03b2f678-f237-4804-a29d-88503a63817e",
         "state": "Allocated",
         "tags": [],
         "zoneid": "91b49be0-5a8b-4f3e-83b8-3bdfee4eba78",
         "zonename": "Sandbox-simulator"
       }
     ]
   }
   ```
   
   After the fix: (domain admin only sees ips from their own projects)
   ```
   (qaprimate) 🐱 > list publicipaddresses  projectid=-1 listall=true 
   {
     "count": 1,
     "publicipaddress": [
       {
         "allocated": "2020-02-25T09:39:16+0100",
         "associatednetworkid": "493824ac-12d5-43c6-b6d6-2246270cf0a0",
         "associatednetworkname": "testdomain-project-net",
         "domain": "Domain",
         "domainid": "d56ba667-945e-46be-8829-e21df75af531",
         "forvirtualnetwork": true,
         "id": "aea77e18-99b8-4a66-8cb5-15e6848134f6",
         "ipaddress": "192.168.2.121",
         "isportable": false,
         "issourcenat": true,
         "isstaticnat": false,
         "issystem": false,
         "networkid": "ecd874e8-9c14-4a66-8528-c4a11960c7be",
         "physicalnetworkid": "08344756-9abc-41c0-b575-8ca1a0a7c77d",
         "project": "DomainAdminProject",
         "projectid": "03b2f678-f237-4804-a29d-88503a63817e",
         "state": "Allocated",
         "tags": [],
         "zoneid": "91b49be0-5a8b-4f3e-83b8-3bdfee4eba78",
         "zonename": "Sandbox-simulator"
       }
     ]
   }
   ```
   
   ... and the root admin is able to see everything:
   ```
   (qaprimate) 🐱 > list publicipaddresses  projectid=-1 listall=true 
filter=id,ipaddress,domain
   {
     "count": 18,
     "publicipaddress": [
       {
         "domain": "ROOT",
         "id": "b3e30c2a-02e9-44b6-b9b2-cd46531d00d7",
         "ipaddress": "192.168.2.99"
       },
       {
         "domain": "ROOT",
         "id": "c70bb8c8-7d41-4686-9740-9626dc216bc9",
         "ipaddress": "192.168.2.98"
       },
       {
         "domain": "ROOT",
         "id": "a5f9da6a-f4cc-44b1-8f5a-4456863d17fb",
         "ipaddress": "192.168.2.97"
       },
       {
         "domain": "ROOT",
         "id": "df296484-5f4c-4b73-a9b9-c14c2900217f",
         "ipaddress": "192.168.2.95"
       },
       {
         "domain": "ROOT",
         "id": "7f53ee95-1ce8-4b02-b4ad-2f7d3c4428d5",
         "ipaddress": "192.168.2.94"
       },
       {
         "domain": "ROOT",
         "id": "28b51886-963c-41d2-9507-3863da658136",
         "ipaddress": "192.168.2.92"
       },
       {
         "domain": "ROOT",
         "id": "2ee8f2bb-c0b1-4a2d-868a-8c28fe9ada66",
         "ipaddress": "192.168.2.4"
       },
       {
         "domain": "ROOT",
         "id": "a1dcfa06-6df4-4710-ad45-83b93e2e6327",
         "ipaddress": "192.168.2.3"
       },
       {
         "domain": "ROOT",
         "id": "26e2d0f7-476d-4598-a2c8-4b59d29aaf8e",
         "ipaddress": "192.168.2.195"
       },
       {
         "domain": "ROOT",
         "id": "3ada9c24-b138-4dd4-ac8a-2260b1865944",
         "ipaddress": "192.168.2.192"
       },
       {
         "domain": "ROOT",
         "id": "b17cc857-e6bd-4cbc-a09e-9f3e4f5c5433",
         "ipaddress": "192.168.2.183"
       },
       {
         "domain": "ROOT",
         "id": "242d048c-fec4-4d02-be32-14e9a29375f5",
         "ipaddress": "192.168.2.181"
       },
       {
         "domain": "ROOT",
         "id": "3574b63a-5dd9-4d1d-8c79-91de2952203d",
         "ipaddress": "192.168.2.168"
       },
       {
         "domain": "ROOT",
         "id": "bdf26431-c879-4750-847f-7303b905f718",
         "ipaddress": "192.168.2.162"
       },
       {
         "domain": "ROOT",
         "id": "8f8fd0cf-5707-4677-ad38-18e3ad8912d1",
         "ipaddress": "192.168.2.155"
       },
       {
         "domain": "ROOT",
         "id": "6330bf8c-d668-413b-9fca-b0ae0111d58d",
         "ipaddress": "192.168.2.127"
       },
       {
         "domain": "Domain",
         "id": "aea77e18-99b8-4a66-8cb5-15e6848134f6",
         "ipaddress": "192.168.2.121"
       },
       {
         "domain": "ROOT",
         "id": "90f7a57f-3dfd-4244-ba08-973bc847d2c0",
         "ipaddress": "192.168.2.103"
       }
     ]
   }
   ```

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


With regards,
Apache Git Services

Reply via email to