Currently in Ax 2012 the user can login multiple times in application, so to restrict users to open Ax 2012 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;
;
if(curUserId()!="Admin")
{
while select SysClientSessions
where SysClientSessions.userId == curUserId()
&& SysClientSessions.Status == 1 // 1 : Login 0 : Logout
&& SysClientSessions.sessionType == 0 // sysClientSessions.clientType == 0
{
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);
}
}
}
http://daynamicsaxaptatutorials.blogspot.in/2011/04/restrict-multiple-user-login-in-axapta.html
https://dynamicsuser.net/ax/f/technical/68340/user-permissions-in-ax2009-to-be-able-to-send-an-e-mail
http://archive.bottomline.com/collateral/technical_documents/TN10%20Microsoft%20Dynamics%20AX%20Connector%20User%20Security%20Permissions.pdf