You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/07/03 08:13:41 UTC

[GitHub] [cloudstack] weizhouapache commented on pull request #3945: server: update template to another template type

weizhouapache commented on pull request #3945:
URL: https://github.com/apache/cloudstack/pull/3945#issuecomment-653416433


   > @ustcweizhou do we want to restrict this to root admin only?
   
   @rhtyd 
   I was thinking about the following change
   ```
   -    @Parameter(name = "templatetype", type = CommandType.STRING, description = "the type of the template")
   +    @Parameter(name = "templatetype", type = CommandType.STRING, description = "the type of the template", authorized
   + = {RoleType.Admin})
        private String templateType;
   ```
   
   however, when I tested with normal user or domain admin, the api succeed without templatetype change.
   ```
   (test1) > update template id="ce3d5211-3209-4617-b569-6c533801a20c" templatetype=SYSTEM
   {
     "template": {
       "account": "test1",
       "bits": 0,
       "bootable": true,
       "created": "2020-06-12T09:54:08+0000",
       "crossZones": false,
       "details": {
         "rootDiskController": "osdefault"
       },
       "displaytext": "ubuntu18-minimal-test1",
       "domain": "test1",
       "domainid": "931bc746-8a9a-45ec-8c50-776b89aed898",
       "format": "QCOW2",
       "hypervisor": "KVM",
       "id": "ce3d5211-3209-4617-b569-6c533801a20c",
       "isdynamicallyscalable": false,
       "isfeatured": false,
       "ispublic": false,
       "isready": false,
       "name": "ubuntu18-minimal-test1",
       "ostypeid": "67bad17c-186e-11ea-83e0-066004001165",
       "ostypename": "Apple Mac OS X 10.6 (32-bit)",
       "tags": [],
       "templatetype": "USER"
     }
   }
   ```
   
   without this change, I got following error which looks better.
   ```
   (test1) > update template id="ce3d5211-3209-4617-b569-6c533801a20c" templatetype=SYSTEM
   Error 531: Parameter templatetype can only be specified by a Root Admin, permission denied
   ```
   


----------------------------------------------------------------
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:
users@infra.apache.org