mirror of https://github.com/apache/cloudstack.git
bug 8477: introducing logic to update a SO from private to public
staut 8477: resolved fixed
This commit is contained in:
parent
deadcd54af
commit
dcdb276295
|
|
@ -39,11 +39,14 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
|||
@Parameter(name=ApiConstants.DISPLAY_TEXT, type=CommandType.STRING, description="the display text of the service offering to be updated")
|
||||
private String displayText;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the service offering to be updated")
|
||||
private Long id;
|
||||
@Parameter(name=ApiConstants.IS_PUBLIC, type=CommandType.BOOLEAN, description="if the service offering needs to be made public , we can only go from private to public and not vice versa")
|
||||
private Boolean isPublic;
|
||||
|
||||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the service offering to be updated")
|
||||
private String serviceOfferingName;
|
||||
|
||||
@Parameter(name=ApiConstants.ID, type=CommandType.LONG, required=true, description="the ID of the service offering to be updated")
|
||||
private Long id;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
|
|
@ -61,7 +64,9 @@ public class UpdateServiceOfferingCmd extends BaseCmd {
|
|||
return serviceOfferingName;
|
||||
}
|
||||
|
||||
|
||||
public Boolean getIsPublic() {
|
||||
return isPublic;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
|
|
|
|||
|
|
@ -1304,7 +1304,8 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
Long id = cmd.getId();
|
||||
String name = cmd.getServiceOfferingName();
|
||||
Long userId = UserContext.current().getCallerUserId();
|
||||
|
||||
Boolean isPublic = cmd.getIsPublic();
|
||||
|
||||
if (userId == null) {
|
||||
userId = Long.valueOf(User.UID_SYSTEM);
|
||||
}
|
||||
|
|
@ -1316,6 +1317,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
}
|
||||
|
||||
boolean updateNeeded = (name != null || displayText != null);
|
||||
|
||||
if(isPublic != null && isPublic)
|
||||
updateNeeded = true;
|
||||
|
||||
if (!updateNeeded) {
|
||||
return _serviceOfferingDao.findById(id);
|
||||
}
|
||||
|
|
@ -1329,6 +1334,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
|
|||
if (displayText != null) {
|
||||
offering.setDisplayText(displayText);
|
||||
}
|
||||
|
||||
if(isPublic != null && isPublic) {
|
||||
offering.setDomainId(null);
|
||||
}
|
||||
|
||||
//Note: tag editing commented out for now; keeping the code intact, might need to re-enable in next releases
|
||||
// if (tags != null)
|
||||
|
|
|
|||
Loading…
Reference in New Issue