ValueOps ConnectALL Product Community

 View Only

BOP-LOGIN Spel Method to get session information

By Giedrius Bekintis posted Jan 04, 2016 04:25 PM

  

I was looking for the method to get information about all current sessions in SDM. As I understand bop-login is the process responsible for handling of the sessions. From trigger definition in ldap.maj i have learned that it is possible to execute methods defined there. Examination of boplgn.exe revealed that there is a number of other methods defined there, and one of them is called session_info that returns a lot of interesting information like:

count of active sessions, session id's, userid, current user role and etc.

 

Here is an example of the code that you can use to execute using bop_cmd

 

void login2()
{
int i,j,count;
send_wait(0, (object)("@|BOP-LOGIN|validate_user|0"), "session_info");
   if (msg_error()) { 
    printf("Error %s",msg[0]);
   }
   else{
    j=0;
    count = msg[0];

    printf("Sessions found: %s \n",count);
    for(i=0;i<count;i++){
    j=i*12+1;

    printf("======= %s ==============\n", msg[j+3]);
    printf("Session ID: %s \n", msg[j]);
    printf("Webengine: %s \n", msg[j+1]);
    printf("Domsrv: %s \n", msg[j+2]);
    printf("Userid: %s \n", msg[j+3]);
    printf("User persistent_id: %s \n", msg[j+4]);
    printf("Current user role: %s \n", msg[j+5]);
    printf("Licensed? %s \n", msg[j+6]);
    printf("Session type: %s \n", msg[j+7]);
    //All session types canS be found in session_type object here are some of them
    //"Web browser session" ,"1"
    //"SOAP Web services session" ,"3"
    //"Server utility session" ,"4"
    //"REST Web Services Session" ,"10"
    printf("Web Service login policy: %s \n", msg[j+8]);
    printf("Session status: %s \n", msg[j+9]);//4 - incative 2 - active 3-timed-out
    printf("Login time stamp: %s \n", msg[j+10]);
    printf("Logout time stamp: %s \n", msg[j+11]);
    printf("\n\n\n");
    }

   }
}

And here is batch file content to execute it

bop_cmd -u ServiceDesk -f %~dp0/log.frg login2("")

 

 

 

I also have plans to explore bop_login methods further. If someone have any info on this topic please share.

16 comments
43 views