setUserId()

Sets the current user ID to the specified value.

Synopsis

bool setUserId( unsigned id [, string password]);

Parameters

Parameter Description
id Required user ID
password associated password

Return value

0 in the event of an error, if, for example, a user with the ID does not exist; if successful 1.

Errors

missing/incorrect argument

Description

This function is called with the required user number to define the current user for the current manager.

  • If the current user is the super user (with the id 0), a password does not have to be entered to change to another user.

  • If the current user is not the super user, the correct password must also be provided for the required new user.

  • If the new user is "no user" (DEFAULT_USERID), a password does not need to be specified.

main()
{
  setUserId(0, "root password");
  /* The current user is not the root user. Change to root user. A password is required. */ 
  setUserId(getUserId("testuser")); /* change from root user to another user . No password required.*/
  setUserId(DEFAULT_USERID); /* change from an other user to default user. No password required.*/
  setUserId(getUserId("testuser"),"testuserpassword"); /* change from default user to another user. A password is required*/
}

For any user to log in via Single Sign on, proceed as follows:

Configure a user in the WinCC OA User Administration. Delete the WinCC OA password of the user in the internal _Users data point (see figure below). The user can now log in using the Windows password.

Abbildung 1. _Users data point

Use the function setUserId(11, „myWindowsPwd2“); / * Switches to the user with the ID 11 and the user can use the Windows password */

Assignment

User administration

Availability

CTRL