1818package org .apache .cloudstack .api .command .user .dns ;
1919
2020import org .apache .cloudstack .acl .RoleType ;
21+ import org .apache .cloudstack .acl .SecurityChecker ;
22+ import org .apache .cloudstack .api .ACL ;
2123import org .apache .cloudstack .api .APICommand ;
2224import org .apache .cloudstack .api .ApiConstants ;
2325import org .apache .cloudstack .api .ApiErrorCode ;
2426import org .apache .cloudstack .api .BaseCmd ;
2527import org .apache .cloudstack .api .Parameter ;
2628import org .apache .cloudstack .api .ServerApiException ;
2729import org .apache .cloudstack .api .response .DnsZoneResponse ;
28- import org .apache .cloudstack .context .CallContext ;
2930import org .apache .cloudstack .dns .DnsZone ;
3031
32+ import com .cloud .user .Account ;
33+
3134@ APICommand (name = "updateDnsZone" ,
3235 description = "Updates a DNS Zone's metadata" ,
3336 responseObject = DnsZoneResponse .class ,
@@ -41,6 +44,7 @@ public class UpdateDnsZoneCmd extends BaseCmd {
4144 //////////////// API Parameters /////////////////////
4245 /////////////////////////////////////////////////////
4346
47+ @ ACL (accessType = SecurityChecker .AccessType .OperateEntry )
4448 @ Parameter (name = ApiConstants .ID , type = CommandType .UUID , entityType = DnsZoneResponse .class ,
4549 required = true , description = "The ID of the DNS zone" )
4650 private Long id ;
@@ -82,6 +86,10 @@ public void execute() {
8286
8387 @ Override
8488 public long getEntityOwnerId () {
85- return CallContext .current ().getCallingAccount ().getId ();
89+ DnsZone dnsZone = _entityMgr .findById (DnsZone .class , id );
90+ if (dnsZone != null ) {
91+ return dnsZone .getAccountId ();
92+ }
93+ return Account .ACCOUNT_ID_SYSTEM ;
8694 }
8795}
0 commit comments