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

Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 26
  • 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: 126
  • Karma: 13
Use the COM Application Block, there are lots of examples on how to set that up.

Then you can use the query

                [code]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);
                }[/code]

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

[code]                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);
                }[/code]

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: 2752
  • Karma: 44
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.

Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 26
  • 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: 126
  • Karma: 13
[quote author=Naveen Kancharla link=topic=9579.msg43270#msg43270 date=1462856487]
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.
[/quote]

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: 26
  • 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: 126
  • Karma: 13
[quote author=Naveen Kancharla link=topic=9579.msg43294#msg43294 date=1462943217]
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.
[/quote]


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]                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");
                    }
                }[/code]


Offline Naveen Kancharla

  • Newbie
  • *
  • Posts: 26
  • 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 03, 2017, 03:07:47 PM »
Hello,
i have a problem to get list of all accessroup :

[code]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
                }
[/code]

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