mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-17 22:29:55 +05:00
Update subflags for *rals from SessionSv1.ProcessEvent
This commit is contained in:
committed by
Dan Christian Bogos
parent
9fcf7b25c2
commit
1d9461aca9
@@ -157,7 +157,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
|
||||
authUsage := 5 * time.Minute
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{utils.ConcatenatedKey(utils.MetaResources, utils.MetaAuthorize),
|
||||
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaAuth),
|
||||
utils.ConcatenatedKey(utils.MetaRALs, utils.MetaAuthorize),
|
||||
utils.MetaSuppliers, utils.MetaAttributes},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -236,7 +236,7 @@ func testSSv1ItProcessEventAuth(t *testing.T) {
|
||||
func testSSv1ItProcessEventInitiateSession(t *testing.T) {
|
||||
initUsage := 5 * time.Minute
|
||||
args := &sessions.V1ProcessEventArgs{
|
||||
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInit),
|
||||
Flags: []string{utils.ConcatenatedKey(utils.MetaRALs, utils.MetaInitiate),
|
||||
utils.ConcatenatedKey(utils.MetaResources, utils.MetaAllocate), utils.MetaAttributes},
|
||||
CGREvent: &utils.CGREvent{
|
||||
Tenant: "cgrates.org",
|
||||
@@ -689,7 +689,8 @@ func testSSv1ItProcessEventWithCDR(t *testing.T) {
|
||||
|
||||
func testSSv1ItGetCDRsFromProcessEvent(t *testing.T) {
|
||||
var cdrCnt int64
|
||||
req := &utils.RPCCDRsFilterWithArgDispatcher{RPCCDRsFilter: &utils.RPCCDRsFilter{OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}}}
|
||||
req := &utils.RPCCDRsFilterWithArgDispatcher{RPCCDRsFilter: &utils.RPCCDRsFilter{
|
||||
OriginIDs: []string{"testSSv1ItProcessEventWithCDR"}}}
|
||||
if err := sSApierRpc.Call(utils.CDRsV1GetCDRsCount, req, &cdrCnt); err != nil {
|
||||
t.Error("Unexpected error: ", err.Error())
|
||||
} else if cdrCnt != 3 { // 3 for each CDR
|
||||
|
||||
@@ -329,10 +329,10 @@ Instead of arguments, the options for enabling various functionaity will come in
|
||||
\*rals
|
||||
Process the event with :ref:`RALs`. Auxiliary flags available:
|
||||
|
||||
**\*auth**
|
||||
**\*authorize**
|
||||
Authorize the event.
|
||||
|
||||
**\*init**
|
||||
**\*initiate**
|
||||
Initialize a session out of event.
|
||||
|
||||
**\*update**
|
||||
|
||||
2
go.sum
2
go.sum
@@ -61,8 +61,6 @@ github.com/cgrates/ltcache v0.0.0-20181016092649-92fb7fa77cca h1:Ejj4m0Ccl8dMMVn
|
||||
github.com/cgrates/ltcache v0.0.0-20181016092649-92fb7fa77cca/go.mod h1:q7c996DUu8OrJRnewVSQzM+y/bRcxZAHoo+zCD8bFBo=
|
||||
github.com/cgrates/radigo v0.0.0-20200324152710-35e651804ad1 h1:QvA6Nbwq9kTd7hsvu1xo5kwia68cLwnp0sYCq1u40TU=
|
||||
github.com/cgrates/radigo v0.0.0-20200324152710-35e651804ad1/go.mod h1:HZbsg3Y+xw4lsfCqX9rzj429wrg0XOug6pFT3B6VHZY=
|
||||
github.com/cgrates/rpcclient v0.0.0-20200107134035-188454eb71b3 h1:esWCSaLD2j+zfK9JpyPXFSe3c97MQFhfKp9jDiss1mU=
|
||||
github.com/cgrates/rpcclient v0.0.0-20200107134035-188454eb71b3/go.mod h1:xXLqAKVvcdWeDYwHJYwDgAI3ZOg5LZYxzb72kLjsLZU=
|
||||
github.com/cgrates/rpcclient v0.0.0-20200326100105-a579e2c47453 h1:kgIdi3qR/meiWILdmDRuDi1fFgd6A3lutGV6HLiTDyc=
|
||||
github.com/cgrates/rpcclient v0.0.0-20200326100105-a579e2c47453/go.mod h1:xXLqAKVvcdWeDYwHJYwDgAI3ZOg5LZYxzb72kLjsLZU=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
|
||||
@@ -37,6 +37,9 @@ cgrates (0.11.0~dev) UNRELEASED; urgency=medium
|
||||
* [Loader] Added support to load CSV files from URL
|
||||
* [Loader] Added configurable gapi_credentials
|
||||
* [Loader] Added configurable gapi_token
|
||||
* [Agents] Add authentication mechanism for Radius (PAP, CHAP,
|
||||
MSCHAPV2)
|
||||
* [SessionS] Update subflags for *rals ( *authorize and *initiate )
|
||||
|
||||
-- Alexandru Tripon <alexandru.tripon@itsyscom.com> Wed, 19 Feb 2020 13:25:52 +0200
|
||||
|
||||
|
||||
@@ -3042,7 +3042,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
}
|
||||
}
|
||||
}
|
||||
// check what we need to do for RALs (*auth/*init/*update/*terminate)
|
||||
// check what we need to do for RALs (*authorize/*initiate/*update/*terminate)
|
||||
if argsFlagsWithParams.HasKey(utils.MetaRALs) {
|
||||
if ralsOpts := argsFlagsWithParams.ParamsSlice(utils.MetaRALs); len(ralsOpts) != 0 {
|
||||
//check for subflags and convert them into utils.FlagsWithParams
|
||||
@@ -3050,7 +3050,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
//for the moment only the the flag will be executed
|
||||
switch {
|
||||
//check for auth session
|
||||
case ralsFlagsWithParams.HasKey(utils.MetaAuth):
|
||||
case ralsFlagsWithParams.HasKey(utils.MetaAuthorize):
|
||||
maxUsage, err := sS.authEvent(args.CGREvent.Tenant,
|
||||
engine.MapEvent(args.CGREvent.Event))
|
||||
if err != nil {
|
||||
@@ -3058,7 +3058,7 @@ func (sS *SessionS) BiRPCv1ProcessEvent(clnt rpcclient.ClientConnector,
|
||||
}
|
||||
rply.MaxUsage = &maxUsage
|
||||
// check for init session
|
||||
case ralsFlagsWithParams.HasKey(utils.MetaInit):
|
||||
case ralsFlagsWithParams.HasKey(utils.MetaInitiate):
|
||||
if ev.HasField(utils.CGRDebitInterval) { // dynamic DebitInterval via CGRDebitInterval
|
||||
if dbtItvl, err = ev.GetDuration(utils.CGRDebitInterval); err != nil {
|
||||
return utils.NewErrRALs(err)
|
||||
|
||||
Reference in New Issue
Block a user