Skip to Content
0
Former Member
Mar 22, 2018 at 02:40 PM

Error while trying to load the list of users connected in Portal 7.5

111 Views Last edit Mar 26, 2018 at 09:13 PM 2 rev

Hi all,

There is a need to control the sessions opened by users, where each user can only have 1 session open.

If the user already has an open session and tries to open a new session in another browser it should be blocked.

Before the upgrade, still in version 7.0nw, for access control we used the WDClientUser API, method getClientUsers ().

The getClientUsers () method. returned a list of logged-in users, but after the upgrade this method stopped working, and we did not find any solution or other method that would get the active users of the Portal

follows our solution method that works in version 7.0 and does not work in version 7.5

  public boolean verificaMultiploLogon( )  {
    //@@begin verificaMultiploLogon()
	 
	SessionID session = new SessionID();
	IWDClientUser userlist[] = WDClientUser.getClientUsers();
	
	int loginCount = 0;
	
	for (int index=0;index < userlist.length;index++)
	{
		if (userlist[index].getSAPUser() != null)
		{
			if (userlist[index].getSAPUser().getUniqueName().equals(session.getLogonId()))
			{
				loginCount++;
			}
		}
	}
	
	if (loginCount > 1 && !session.getLogonId().toUpperCase().equals("MFARIAS") && !session.getLogonId().toUpperCase().equals("LBATISTA") && !session.getLogonId().toUpperCase().equals("LPRATES") && !session.getLogonId().toUpperCase().equals("CASILVA03"))
	{
		String message = wdComponentAPI.getTextAccessor().getText(IMessageAutoWMFabNewComponent.E03, new String[]{session.getLogonId().toUpperCase()});
		this.messageManager.reportException(message, false);
		return false;
	}
	else
	{
		return true;
	}    
    //@@end
  }