28.10.2006, 16:40 | #1 |
Участник
|
Fred Shen: Limited sessions in Axapta
Источник: http://fredshen.spaces.live.com/Blog...E4E3!173.entry
============== Some Axapta system administrator may feel it is really annoying that Axapta allows the user to create multiple Axapta sessions and log in as the same user. If you want to give the user notification prior to logging in as the same User ID, here comes the solution. Under the Info class, modified the startupPost method like the codes below: void startupPost() { int counter; int num = 0; int maxSessions = Info::licensedUsersTotal(); xSession session; UserInfo userInfo; UserId currentUserId; ; currentUserId = curuserid(); for(counter = 1; counter < maxSessions;counter++ ) { session = new xSession(counter, true); if(session && session.userId()) { select firstOnly userInfo where userInfo.id == session.userId(); if (userInfo && (currentUserId == session.userId())) { num++ ; } } } if (num > 1) { if(box::yesno("The same user id can't log in twice. Do you want to log in anyway? ", DialogButton::Yes, "Log in", "Log out") == DialogButton::No) { infolog.shutDown(true); } } } Please notice that, if you modify the startupPost method of Application class, that works only in 2-tier environment. For both 2-tier and 3-tier environment, it is recommended to modify the startupPost method of Info class. ============== Источник: http://fredshen.spaces.live.com/Blog...E4E3!173.entry |
|