Author Topic: required code for retrieving a particular agent access group using SDK.  (Read 2534 times)

Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 24
  • Karma: -1
I am working on web application using .net sdk want to check agents access group, need a brief idea how to retrieve.kindly suggest.

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 106
  • Karma: 9
Use the COM Application Block, there are lots of examples on how to set that up.

Then you can use the query

               
Code: [Select]
CfgAccessGroupQuery query = new CfgAccessGroupQuery();
                query.Name = "Administrators";
                query.TenantDbid = 1;
                ICollection<CfgAccessGroup> accessGroups = confService.RetrieveMultipleObjects<CfgAccessGroup>(query);
                foreach (CfgAccessGroup accessGroup in accessGroups)
                {
                    log.Debug(accessGroup);
                }

Or is you want to find out the AccessGroups a person belongs to you can use this query:

Code: [Select]
                CfgAccessGroupQuery query = new CfgAccessGroupQuery();
                query.PersonDbid = 748;
                query.TenantDbid = 1;
                ICollection<CfgAccessGroup> accessGroups = confService.RetrieveMultipleObjects<CfgAccessGroup>(query);
                foreach (CfgAccessGroup accessGroup in accessGroups)
                {
                    log.Debug(accessGroup);
                }

Offline Sudherson Nadar

  • Newbie
  • *
  • Posts: 16
  • Karma: -2
I am also having the same issue!!!
not solved yet.
Required code for retrieving a particular agent access group using SDK.

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2545
  • Karma: 41
And what is the exactly problem? If you take a look at post from Peter Hoyle, there you can find the code how to retrieve the agent's access group/s.
Genesys certified professional consultant (GVP, SIP, GIR and Troubleshooting)

Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 24
  • Karma: -1
thanx PeteHoyle it help me alot, but i need little more help.
While execute the code it shows list of all user having access to mentioned access group.if suppose i want a particular user from the list what will be the code for it.

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 106
  • Karma: 9
thanx PeteHoyle it help me alot, but i need little more help.
While execute the code it shows list of all user having access to mentioned access group.if suppose i want a particular user from the list what will be the code for it.

Hi,

Can you explain a bit more about what you are trying to do, there is an example above of how to get the AccessGroups for a particular User.

Pete.

Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 24
  • Karma: -1
code o/p:
 CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgAccessGroup
properties : { groupInfo : CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgGroup properties : { DBID : 262 tenantDBID : 1 name : GAX EZPulse managerDBIDs : A collection of DBIDs = NULL routeDNDBIDs : A collection of DBIDs = NULL capacityTableDBID : 0 quotaTableDBID : 0 state : 1 userProperties : KVList: capacityRuleDBID : 0 siteDBID : 0 contractDBID : 0 }
memberIDs : A list of structures (Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID) length = 16 { CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
properties : { CSID : 0 DBID : 102 type : 3 }
CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
 properties : { CSID : 0 DBID : 731 type : 3 }
CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
properties : { CSID : 0 DBID : 732 type : 3 }

you can see that multiple user are their in output. so, how can i retrieve particular user from the list.

Offline PeteHoyle

  • Full Member
  • ***
  • Posts: 106
  • Karma: 9
code o/p:
 CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgAccessGroup
properties : { groupInfo : CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgGroup properties : { DBID : 262 tenantDBID : 1 name : GAX EZPulse managerDBIDs : A collection of DBIDs = NULL routeDNDBIDs : A collection of DBIDs = NULL capacityTableDBID : 0 quotaTableDBID : 0 state : 1 userProperties : KVList: capacityRuleDBID : 0 siteDBID : 0 contractDBID : 0 }
memberIDs : A list of structures (Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID) length = 16 { CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
properties : { CSID : 0 DBID : 102 type : 3 }
CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
 properties : { CSID : 0 DBID : 731 type : 3 }
CfgObject type = Genesyslab.Platform.ApplicationBlocks.ConfigurationObjectModel.CfgObjects.CfgID
properties : { CSID : 0 DBID : 732 type : 3 }

you can see that multiple user are their in output. so, how can i retrieve particular user from the list.


So you could iterate through the MemberIds until you find the DBID of the Agent you want to check, or you could use this query which gets the Access Groups that an Agent belongs to and then look for a match on the Access Group Name


Code: [Select]
                CfgAccessGroupQuery query = new CfgAccessGroupQuery();
                query.PersonDbid = 731;
                query.TenantDbid = 1;
                ICollection<CfgAccessGroup> accessGroups = confService.RetrieveMultipleObjects<CfgAccessGroup>(query);
                foreach (CfgAccessGroup accessGroup in accessGroups)
                {
                    log.Debug(accessGroup.GroupInfo.Name);
                    if(accessGroup.GroupInfo.Name == "GAX EZPulse")
                    {
                        log.Debug("Agent is a Member of GAX EZPulse");
                    }
                }


Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 24
  • Karma: -1
thanx a lot!!!!!

Offline abou

  • Newbie
  • *
  • Posts: 1
  • Karma: 0
Re: required code for retrieving a particular agent access group using SDK.
« Reply #9 on: January 04, 2017, 12:07:47 AM »
Hello,
i have a problem to get list of all accessroup :

Code: [Select]
try
            {
                var accessGroupQuery = new CfgAccessGroupQuery 
                {
                   // TenantDbid = Int32.Parse(tenantDBID),
                   TenantDbid = 101,
                };

                ICollection<CfgAccessGroup> accessGroupList =
                    CsProxyAccessor.Instance.RetrieveMultipleObjects<CfgAccessGroup>(accessGroupQuery);
               
                foreach(CfgAccessGroup accessGroup in accessGroupList)
                {
                    sb.Append(GisInteroperability.ToGisXML(accessGroup.ToXml().ToXmlNode().OuterXml, "CfgAccessGroup", string.Empty)); //read the XML and test it
                }

the accessgrouplist contain elements but not exactly a collection of <CFgAccessGroup>
screenshot (bottom)
https://drive.google.com/file/d/0B4atrkOwAJq5U0lWcUYtRUJ3aTQ/view?usp=sharing
« Last Edit: January 04, 2017, 12:15:43 AM by abou »