SessionSv1.AuthorizeEventWithDigest returning MaxUsage as float64 instead of duration, thanks @razvanc

This commit is contained in:
DanB
2018-03-21 19:15:31 +01:00
parent 0213825d3c
commit 1e3608571e
2 changed files with 3 additions and 3 deletions

View File

@@ -210,7 +210,7 @@ func TestSSv1ItAuthWithDigest(t *testing.T) {
if err := sSv1BiRpc.Call(utils.SessionSv1AuthorizeEventWithDigest, args, &rply); err != nil {
t.Error(err)
}
if *rply.MaxUsage != authUsage {
if *rply.MaxUsage != authUsage.Seconds() {
t.Errorf("Unexpected MaxUsage: %v", rply.MaxUsage)
}
if *rply.ResourceAllocation == "" {

View File

@@ -1456,7 +1456,7 @@ func (smg *SMGeneric) BiRPCv1AuthorizeEvent(clnt rpcclient.RpcClientConnection,
type V1AuthorizeReplyWithDigest struct {
AttributesDigest *string
ResourceAllocation *string
MaxUsage *time.Duration
MaxUsage *float64 // special treat returning time.Duration.Seconds()
SuppliersDigest *string
}
@@ -1479,7 +1479,7 @@ func (smg *SMGeneric) BiRPCv1AuthorizeEventWithDigest(clnt rpcclient.RpcClientCo
authReply.ResourceAllocation = initAuthRply.ResourceAllocation
}
if args.GetMaxUsage {
authReply.MaxUsage = initAuthRply.MaxUsage
authReply.MaxUsage = utils.Float64Pointer(initAuthRply.MaxUsage.Seconds())
}
if args.GetSuppliers {
authReply.SuppliersDigest = utils.StringPointer(initAuthRply.Suppliers.Digest())