Skip to content

SWITCH_USER_CONTEXT

SWITCH_USER_CONTEXT activates a special user context, which means that the application (temporarily) behaves as if another user than the login user is the active one.

Syntax

leo-grammar
CC "UserMgt" SWITCH_USER_CONTEXT userid:intValue | default 

# --> RESULT ecode:intValue
CC "UserMgt" SWITCH_USER_CONTEXT userid:intValue | default 

# --> RESULT ecode:intValue

Parameters

  • userid (intValue) - specifies an existing user
  • default(modifier) -

Returns

  • ecode (intValue) - Contains the error code or is 0 in case of success.

Details

To switch back to the original status the command has to be called with default.

While the application is running in a special user context, the special user is not really logged in with the running application instance, which means that the a user context can be used for several application instances at the same time, while this is not allowed for login users.

The switching to a special user context and the back-switching must happen in the same running script. When a script terminates in a special user context, the user context is reset automatically. (However, scripts should not rely on that behavior.)

This command is available within both the ADOxx Development Toolkit and the ADOxx Modelling Toolkit. In the Modelling Toolkit only users that also have access to the Development Toolkit may call this command!

See Also

Examples

leo-grammar
CC "UserMgt" GET_USER_ID user:"Özil"
CC "UserMgt" SWITCH_USER_CONTEXT userid:(userid)
# ...
CC "UserMgt" SWITCH_USER_CONTEXT default
CC "UserMgt" GET_USER_ID user:"Özil"
CC "UserMgt" SWITCH_USER_CONTEXT userid:(userid)
# ...
CC "UserMgt" SWITCH_USER_CONTEXT default

Versions and Changes

Available since ADOxx 1.3