From 119b78fa82e86e97ceff76bf70317f53f3ef3d7e Mon Sep 17 00:00:00 2001 From: Henry Avetisyan Date: Thu, 16 May 2024 11:22:05 -0700 Subject: [PATCH] provide capability for system admins to use zms-cli to set business service Signed-off-by: Henry Avetisyan --- libs/go/zmscli/domain.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/go/zmscli/domain.go b/libs/go/zmscli/domain.go index f798cec84bc..b5d8c6d6c2a 100644 --- a/libs/go/zmscli/domain.go +++ b/libs/go/zmscli/domain.go @@ -1230,7 +1230,16 @@ func (cli Zms) SetDomainBusinessService(dn string, businessService string) (*str } err = cli.SetCompleteDomainMeta(dn, domain.Description, string(domain.Org), domainAuditEnabled, domain.ApplicationId, businessService) if err != nil { - return nil, err + // if the operation fails we're going to try the operation as a system + // administrator who might have required authorization to set the business + // service on all domains instead of the domain administrator + meta := zms.DomainMeta{ + BusinessService: businessService, + } + // if the operation fails, we're going to return the original error + if cli.Zms.PutDomainSystemMeta(zms.DomainName(dn), "businessservice", cli.AuditRef, &meta) != nil { + return nil, err + } } s := "[domain " + dn + " business-service successfully updated]\n" message := SuccessMessage{