Default user?

Find and share HowTos to various installations / configurations!
14 posts • Page 2 of 2
n_lev
Posts:73
Joined: Tue May 28, 2013 2:24 am

Re: Default user?

Post by n_lev »

Fair enough. Thanks for your help, guys. I implemented what I needed by dpConnect'ing to the username and re-logging in into "guest" once the username changes to "".

jimtaylor
Posts:32
Joined: Tue Jun 11, 2013 10:18 am

Re: Default user?

Post by jimtaylor »

Sorry to open up an old thread but this is exactly the functionality we want to implement.

Can anyone please tell me what function to use to re-login as guest? I have tried setUserId(4096) [and variations like setUserId(getUserId("guest") or setUserId(4096, "")] but this does not seem to work.

Many thanks.

Jim

n_lev
Posts:73
Joined: Tue May 28, 2013 2:24 am

Re: Default user?

Post by n_lev »

I did something like this:

Code: Select all

main()
{
  string dp;
   
  dp = myUiDpName() + ".UserName:_original.._value"; 
  dpConnect("changeUser", dp);
}  

changeUser (string dpUser, string user)
{
  // If username changed to ""
  // login as "guest"
  // When logging in from one user to another
  // the system actually changes Ui.UserName to "" first
  // before changing it to a new user name
  // hence the use of "getUserName()" function
  // so we can ignore that first change to the Ui.UserName
  if(user == "" && getUserName() == "") 
  {
    setUserId(getUserId("guest"),""); 
    dpSet(dpUser,"guest");
  }
}
That should get you started

jimtaylor
Posts:32
Joined: Tue Jun 11, 2013 10:18 am

Re: Default user?

Post by jimtaylor »

Brilliant - thanks Nick

14 posts • Page 2 of 2