Hie,
Currently in Ax 2009 the user can login multiple times in application, so to restrict users to open Ax 2009 multiple times we can use the following code.
** Before implementing this please take backup of your application files
Open Classes --> info --> StartupPost metod
and copy following code into this method
void startupPost()
{
// To restrict user login form second login
xSession session;
SysClientSessions SysClientSessions;
UserId currentUserId;
int counter;
// To restrict user login form second login
xSession session;
SysClientSessions SysClientSessions;
UserId currentUserId;
int counter;
;
currentUserId = curUserId();
if(currentUserId!=”Admin”) // Allow Admin User to login multiple time
{
while select SysClientSessions
where SysClientSessions.userId == currentUserId
{
while select SysClientSessions
where SysClientSessions.userId == currentUserId
&& SysClientSessions.Status == 1 // 1 : Login 0 : Logout
{
session = new xSession(SysClientSessions.SessionId, true);
if (session && session.userId())
{
counter++;
}
}
session = new xSession(SysClientSessions.SessionId, true);
if (session && session.userId())
{
counter++;
}
}
if(counter>=2)
{
Box::stop(“Already Logged-in : The same user id can’t log in twice.”);
infolog.shutDown(true);
}
}
}
{
Box::stop(“Already Logged-in : The same user id can’t log in twice.”);
infolog.shutDown(true);
}
}
}
No comments:
Post a Comment