Github user sudhansu7 commented on the issue:

    https://github.com/apache/cloudstack/pull/1763
  
    @abhinandanprateek 
    Below is test scenario and result. I have also reverted the changes 
introduced in CLOUDSTACK-9376.
    
    Test Scenario:
    
    Domain: SUDDOMAIN
    Domain Admin: sudadmin
    Registered a template Debian.
    ```
    {
            "account": "sudadmin",
            "checksum": "e87a6d7291b999c92baa9623c9c3c207",
            "created": "2016-11-10T17:18:00-0500",
            "crossZones": false,
            "details": {
                "hypervisortoolsversion": "xenserver61"
            },
            "displaytext": "Debian",
            "domain": "SUDDOMAIN",
            "domainid": "a350c00d-4048-4876-ae09-74ad4b7bb28c",
            "format": "VHD",
            "hypervisor": "XenServer",
            "id": "51026d32-60ee-4e25-8ffd-3fa3c57fc14c",
            "isdynamicallyscalable": false,
            "isextractable": false,
            "isfeatured": false,
            "ispublic": false,
            "isready": true,
            "name": "Debian",
            "ostypeid": "38c1fc84-a687-11e6-a8c8-06f654000053",
            "ostypename": "Debian GNU/Linux 7(64-bit)",
            "passwordenabled": false,
            "size": 2621440000,
            "sshkeyenabled": false,
            "tags": [],
            "templatetype": "USER",
            "zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
            "zonename": "z1"
    }
    ```
    
    Domain: SUDDOMAIN1
    Domain Admin user: sudadmin1
    
    No template resigtered.
    
    normal user: suduser1
    Registed a template 'debian-user'
    ```
    {
        "account": "suduser1",
        "checksum": "b118393ea4a86c494669d915d8a788cf",
        "created": "2016-12-06T16:20:57-0500",
        "crossZones": false,
        "details": {
            "hypervisortoolsversion": "xenserver61"
        },
        "displaytext": "debian-user",
        "domain": "SUDDOMAIN1",
        "domainid": "204c25e0-307e-4cf9-974c-e6aca6cc5257",
        "format": "VHD",
        "hypervisor": "XenServer",
        "id": "696fcbf5-5644-44a2-a0b4-88d131bb70cb",
        "isdynamicallyscalable": false,
        "isextractable": false,
        "isfeatured": false,
        "ispublic": false,
        "isready": true,
        "name": "debian-user",
        "ostypeid": "38c1fc84-a687-11e6-a8c8-06f654000053",
        "ostypename": "Debian GNU/Linux 7(64-bit)",
        "passwordenabled": false,
        "size": 2621440000,
        "sshkeyenabled": false,
        "tags": [],
        "templatetype": "USER",
        "zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
        "zonename": "z1"
    }
    ```
    
    API results:
    
    With (CLOUDSTACK-9376) for 4.5+. commit 0cb60a7:
    
    
http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=self&_=1481042783138
    
    {"listtemplatesresponse":{}}
    
    Result: Domain admin does not have any templates and so no results.
    
    
http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=all&_=1481042783138
    
    
{"listtemplatesresponse":{"uuidList":[],"errorcode":431,"cserrorcode":4350,"errortext":"Filter
 all can be specified by admin only"}}
    
    Result: with templatefilter=all we are getting above error respose as 
expected. But with this domain admin does not have any visibility of templates 
resgistered under his domain.
    
    With the current fix:
    
    
http://10.147.59.107:8080/client/api?command=listTemplates&response=json&listAll=true&page=1&pagesize=200&templatefilter=all&_=1481045782311
    ```
    {
        "listtemplatesresponse": {
            "count": 2,
            "template": [
                {
                    "account": "system",
                    "checksum": "905cec879afd9c9d22ecc8036131a180",
                    "created": "2016-11-10T09:32:44-0500",
                    "crossZones": true,
                    "displaytext": "CentOS 5.6(64-bit) no GUI (XenServer)",
                    "domain": "ROOT",
                    "domainid": "383e0ea6-a687-11e6-a8c8-06f654000053",
                    "format": "VHD",
                    "hypervisor": "XenServer",
                    "id": "38451a02-a687-11e6-a8c8-06f654000053",
                    "isdynamicallyscalable": true,
                    "isextractable": true,
                    "isfeatured": true,
                    "ispublic": true,
                    "isready": true,
                    "name": "CentOS 5.6(64-bit) no GUI (XenServer)",
                    "ostypeid": "38a2bfd6-a687-11e6-a8c8-06f654000053",
                    "ostypename": "CentOS 5.6 (64-bit)",
                    "passwordenabled": false,
                    "size": 21474836480,
                    "sshkeyenabled": false,
                    "tags": [],
                    "templatetype": "BUILTIN",
                    "zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
                    "zonename": "z1"
                },
                {
                    "account": "suduser1",
                    "checksum": "b118393ea4a86c494669d915d8a788cf",
                    "created": "2016-12-06T16:20:57-0500",
                    "crossZones": false,
                    "details": {
                        "hypervisortoolsversion": "xenserver61"
                    },
                    "displaytext": "debian-user",
                    "domain": "SUDDOMAIN1",
                    "domainid": "204c25e0-307e-4cf9-974c-e6aca6cc5257",
                    "format": "VHD",
                    "hypervisor": "XenServer",
                    "id": "696fcbf5-5644-44a2-a0b4-88d131bb70cb",
                    "isdynamicallyscalable": false,
                    "isextractable": false,
                    "isfeatured": false,
                    "ispublic": false,
                    "isready": true,
                    "name": "debian-user",
                    "ostypeid": "38c1fc84-a687-11e6-a8c8-06f654000053",
                    "ostypename": "Debian GNU/Linux 7(64-bit)",
                    "passwordenabled": false,
                    "size": 2621440000,
                    "sshkeyenabled": false,
                    "tags": [],
                    "templatetype": "USER",
                    "zoneid": "25fa5b74-d4c2-4bad-8e3a-ceffcd10985e",
                    "zonename": "z1"
                }
            ]
        }
    }
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to