How can I fInd the current user in batch mode?

If I run a DXL script interactively I can do something like

User usrCur = find()

to find out who executes the script.

If I run the same script in batch mode I get the message

 There is no current user

I've been looking for a way to get the values of the switches (-user & -password) but did not find anything.

Anybody got an idea what to do?

I need this to check the user against the environment (different sets of clients may be executed only by certain users)


DolfRiedel - Thu Jul 30 04:45:32 EDT 2015

Re: How can I fInd the current user in batch mode?
Wolfgang Uhr - Thu Jul 30 11:19:47 EDT 2015

Hi

There is no current user and there is nothing you can change this. That is because you do not have a complete client. Some dxl-commands for example do not work in the batch mode.

Try to use:

hostname();

Best Regards

Wolfgang

Re: How can I fInd the current user in batch mode?
DolfRiedel - Fri Jul 31 05:53:36 EDT 2015

Wolfgang Uhr - Thu Jul 30 11:19:47 EDT 2015

Hi

There is no current user and there is nothing you can change this. That is because you do not have a complete client. Some dxl-commands for example do not work in the batch mode.

Try to use:

hostname();

Best Regards

Wolfgang

Wolfgang,

nice try, but ... I'm not looking for the hostname of the PC on which the DOORS client runs.

I want to know the DOORS UserID, Account Name of the person who started the client with something like "doors.exe -d 36677@terra.X.com-user <USERNAME> -password <PWD> -batch <BATCHFILE.dxl>.

In this case USERNAME.

Gruss, Dolf

Re: How can I fInd the current user in batch mode?
Wolfgang Uhr - Fri Jul 31 08:00:32 EDT 2015

DolfRiedel - Fri Jul 31 05:53:36 EDT 2015

Wolfgang,

nice try, but ... I'm not looking for the hostname of the PC on which the DOORS client runs.

I want to know the DOORS UserID, Account Name of the person who started the client with something like "doors.exe -d 36677@terra.X.com-user <USERNAME> -password <PWD> -batch <BATCHFILE.dxl>.

In this case USERNAME.

Gruss, Dolf

> I need this to check the user against the environment (different sets of clients may be executed only by certain users)

It was an idea - perhaps hostname is ok, otherwise, there is no chance.

Re: How can I fInd the current user in batch mode?
pommCannelle - Fri Jul 31 08:56:57 EDT 2015

(Have you tried the functions doorsname / username ;) )

Re: How can I fInd the current user in batch mode?
DolfRiedel - Fri Jul 31 08:58:56 EDT 2015

pommCannelle - Fri Jul 31 08:56:57 EDT 2015

(Have you tried the functions doorsname / username ;) )

doorsname works!

Thanks - it's not quite documented however - I only find 2-3 references in  the 9.6 DXL manual, all of them referring to usage of doorsname.

Re: How can I fInd the current user in batch mode?
pommCannelle - Fri Jul 31 12:26:07 EDT 2015

DolfRiedel - Fri Jul 31 08:58:56 EDT 2015

doorsname works!

Thanks - it's not quite documented however - I only find 2-3 references in  the 9.6 DXL manual, all of them referring to usage of doorsname.

You should find the username perm's documentation in the section 'Operating system commands' ... ;)

 

Re: How can I fInd the current user in batch mode?
Mathias Mamsch - Fri Jul 31 13:08:03 EDT 2015

pommCannelle - Fri Jul 31 12:26:07 EDT 2015

You should find the username perm's documentation in the section 'Operating system commands' ... ;)

 

You can get EVERY commandline parameter from the environment - just prepend DOORS, e.g.:

 

getenv "DOORSUSER"  // get batch username ...

getenv "DOORSPASSWORD"  // get plaintext password (sic!)

getenv "DOORSADDINS"   // get addins path if passed over the commandline

getenv "DOORSBATCH"  // get the current batch file

,,,

Regards, Mathias

Re: How can I fInd the current user in batch mode?
DolfRiedel - Thu Oct 01 10:19:15 EDT 2015

Mathias Mamsch - Fri Jul 31 13:08:03 EDT 2015

You can get EVERY commandline parameter from the environment - just prepend DOORS, e.g.:

 

getenv "DOORSUSER"  // get batch username ...

getenv "DOORSPASSWORD"  // get plaintext password (sic!)

getenv "DOORSADDINS"   // get addins path if passed over the commandline

getenv "DOORSBATCH"  // get the current batch file

,,,

Regards, Mathias

All,

very helpful - this code will always deliver the correct name of the user executing DOORS:

string sU

sU = doorsname() // GUI

if (sU == "") {sU = getenv("DOORSUSER")} // Batch