mirror of https://github.com/apache/cloudstack.git
api: Allowing template owner to download template (#3475)
Removed the download icon when a template is not extractable. Modified the api to allow a user from the same account as the template, to change the extractable attribute on the template. Fixes #3400
This commit is contained in:
parent
c88540d5a5
commit
b509e086f9
|
|
@ -1523,9 +1523,9 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
}
|
||||
|
||||
if (isExtractable != null) {
|
||||
// Only Root admins allowed to change it for templates
|
||||
if (!template.getFormat().equals(ImageFormat.ISO) && !_accountMgr.isRootAdmin(caller.getId())) {
|
||||
throw new InvalidParameterValueException("Only ROOT admins are allowed to modify isExtractable attribute.");
|
||||
// Only Root admins and owners are allowed to change it for templates
|
||||
if (!template.getFormat().equals(ImageFormat.ISO) && caller.getId() != ownerId && !isAdmin) {
|
||||
throw new InvalidParameterValueException("Only ROOT admins and template owners are allowed to modify isExtractable attribute.");
|
||||
} else {
|
||||
// For Isos normal user can change it, as their are no derivatives.
|
||||
updatedTemplate.setExtractable(isExtractable.booleanValue());
|
||||
|
|
|
|||
|
|
@ -1595,12 +1595,7 @@
|
|||
isextractable: {
|
||||
label: 'label.extractable.lower',
|
||||
isBoolean: true,
|
||||
isEditable: function() {
|
||||
if (isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isEditable: true,
|
||||
converter: cloudStack.converters.toBooleanText
|
||||
},
|
||||
passwordenabled: {
|
||||
|
|
@ -2039,12 +2034,7 @@
|
|||
isextractable: {
|
||||
label: 'label.extractable.lower',
|
||||
isBoolean: true,
|
||||
isEditable: function() {
|
||||
if (isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isEditable: true,
|
||||
converter: cloudStack.converters.toBooleanText
|
||||
},
|
||||
passwordenabled: {
|
||||
|
|
@ -3327,12 +3317,7 @@
|
|||
isextractable: {
|
||||
label: 'label.extractable.lower',
|
||||
isBoolean: true,
|
||||
isEditable: function() {
|
||||
if (isAdmin())
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
},
|
||||
isEditable: true,
|
||||
converter: cloudStack.converters.toBooleanText
|
||||
},
|
||||
bootable: {
|
||||
|
|
@ -3449,7 +3434,9 @@
|
|||
|| (jsonObj.isready == false) || jsonObj.templatetype == "SYSTEM") {
|
||||
//do nothing
|
||||
} else {
|
||||
allowedActions.push("downloadTemplate");
|
||||
if (jsonObj.isextractable){
|
||||
allowedActions.push("downloadTemplate");
|
||||
}
|
||||
}
|
||||
|
||||
// "Delete Template"
|
||||
|
|
|
|||
Loading…
Reference in New Issue