../pvss.htm menu.gif basics.gif

setUserId()

Sets the current user ID to the specified value.

Synopsis

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

Parameters

    Parameter

    Meaning

    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.

IconExample

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
}

Assignment

User administration

Availability

UI, CTRL, DP

See also

      getUserId(), checkPassword(), crypt()

Top Of Page

 

V 3.11 SP1

Copyright ETM professional control GmbH 2013 All Rights Reserved