File tree Expand file tree Collapse file tree 2 files changed +9
-22
lines changed
server/src/main/java/com/cloud/template Expand file tree Collapse file tree 2 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -1523,9 +1523,9 @@ public boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissions
15231523 }
15241524
15251525 if (isExtractable != null ) {
1526- // Only Root admins allowed to change it for templates
1527- if (!template .getFormat ().equals (ImageFormat .ISO ) && ! _accountMgr . isRootAdmin ( caller .getId ()) ) {
1528- throw new InvalidParameterValueException ("Only ROOT admins are allowed to modify isExtractable attribute." );
1526+ // Only Root admins and owners are allowed to change it for templates
1527+ if (!template .getFormat ().equals (ImageFormat .ISO ) && caller .getId () != ownerId && ! isAdmin ) {
1528+ throw new InvalidParameterValueException ("Only ROOT admins and template owners are allowed to modify isExtractable attribute." );
15291529 } else {
15301530 // For Isos normal user can change it, as their are no derivatives.
15311531 updatedTemplate .setExtractable (isExtractable .booleanValue ());
Original file line number Diff line number Diff line change 15951595 isextractable : {
15961596 label : 'label.extractable.lower' ,
15971597 isBoolean : true ,
1598- isEditable : function ( ) {
1599- if ( isAdmin ( ) )
1600- return true ;
1601- else
1602- return false ;
1603- } ,
1598+ isEditable : true ,
16041599 converter : cloudStack . converters . toBooleanText
16051600 } ,
16061601 passwordenabled : {
20392034 isextractable : {
20402035 label : 'label.extractable.lower' ,
20412036 isBoolean : true ,
2042- isEditable : function ( ) {
2043- if ( isAdmin ( ) )
2044- return true ;
2045- else
2046- return false ;
2047- } ,
2037+ isEditable : true ,
20482038 converter : cloudStack . converters . toBooleanText
20492039 } ,
20502040 passwordenabled : {
33273317 isextractable : {
33283318 label : 'label.extractable.lower' ,
33293319 isBoolean : true ,
3330- isEditable : function ( ) {
3331- if ( isAdmin ( ) )
3332- return true ;
3333- else
3334- return false ;
3335- } ,
3320+ isEditable : true ,
33363321 converter : cloudStack . converters . toBooleanText
33373322 } ,
33383323 bootable : {
34493434 || ( jsonObj . isready == false ) || jsonObj . templatetype == "SYSTEM" ) {
34503435 //do nothing
34513436 } else {
3452- allowedActions . push ( "downloadTemplate" ) ;
3437+ if ( jsonObj . isextractable ) {
3438+ allowedActions . push ( "downloadTemplate" ) ;
3439+ }
34533440 }
34543441
34553442 // "Delete Template"
You can’t perform that action at this time.
0 commit comments