Please enable JavaScript to view this site.

QPR Knowledge Base 2019.1

Navigation: Developer's Guide > QPR API > The Object Model > QPR Modeling > PGApplication Commands

Authenticate

Scroll Prev Top Next More

Revision history:

Introduced in QPR 7.2.1

Last changed in QPR 2012.2

 

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:

 

PGApplication.Authenticate(User, Password, Domain)

 

Parameters:

 

User: 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_SUCCESS

RV_APPLICATION_QUIT_CALLED

RV_CANNOT_CLOSE_MODEL

RV_CANNOT_CONNECT_TO_SERVER (If a server connection was not open, a connection is tried to the server configured in the QPR Modeling Client).

RV_LOGIN_FAILED

RV_IWA_NOT_IN_USE

RV_NO_LICENSE_TO_CONNECT_TO_SERVER

RV_FUNCTION_CANNOT_BE_USED_IN_VALIDATION_SCRIPT

 

Example Procedure:

 

Sub ConnectToServerAndAuthenticate()

 Dim iResult

 Dim oModel

 iResult = PGApplication.ConnectToServer("", 0)

 If (iResult <> 0) Then

   MsgBox "Could not connect to default server: " + PGApplication.GetErrorMessage(iResult)

 End If

 iResult = PGApplication.Authenticate("qpr", "demo", "")

 If (iResult <> 0) Then

   MsgBox "Authentication failed: " + PGApplication.GetErrorMessage(iResult)

 End If

End Sub