|
||
Revision history:
Introduced in QPR 7.2.1
Authenticates the user. If a model is open, it is closed first. Calling this function is not mandatory in script functions: if no user is authenticated when some other script function is called, login dialog is shown and the user can authenticate during the execution of the script (if the user interface is not hidden, see SetUIMode).
Synopsis:
SCApplication.Authenticate(username, password, domain)
Parameters:
Username: Username for logging into the server. String
Password: Password of the user defined in the User parameter. String
Domain: The domain that contains the user account defined in the User parameter. Can be left empty if NT authentication is not used. String
If empty parameters are given, authentication is done with Integrated Windows Authentication. See Security Level for Executing QPR Script for instructions on how to allow IWA.
Required Rights:
None
Return Values:
Below are listed the return values that this function can return:
RV_APPLICATION_QUIT_CALLED
RV_SUCCESS
RV_LOGIN_FAILED
RV_IWA_NOT_IN_USE
Example Procedure:
Sub ConnectToServerAndAuthenticate()
Dim iResult
Dim oModel
iResult = SCApplication.ConnectToServer("", 0)
If (iResult <> 0) Then
MsgBox "Could not connect to default server: " + SCApplication.GetErrorMessage(iResult)
End If
iResult = SCApplication.Authenticate("qpr", "demo", "")
If (iResult <> 0) Then
MsgBox "Authentication failed: " + SCApplication.GetErrorMessage(iResult)
End If
End Sub