Cicode Programming Reference > Cicode Function Categories > Security Functions Introduction > UserVerify

UserVerify

Verifies a given user by authenticating the user's credential, verifies the user privileges and areas against those specified in the functions parameters. Successful verification however does not log the user into the CitectSCADA runtime system.

Syntax

UserVerify(sName, sPassword [, sAccess] [, sPrivGlobal] [, sPriv1..sPriv8] )

sName:

The name of the user.

sPassword:

The password of the user. The sPassword argument needs to be passed as a secure string.

sAccess:

Specifies the required user's viewable areas.

sPrivGlobal:

Specifies the required user's global privilege.

sPriv1-8:

Specifies the required areas for privileges 1 - 8. That is, sPriv1 contains the areas (1,2,3,4,...,255) where the user has Privilege 1.

Return Value

0 (zero) if successful, otherwise an error is returned.

The successful verification has to meet the following conditions:

Related Functions

UserDelete, UserEditForm, UserPassword, UserPasswordForm, UserCreateForm

Example

INT FUNCTION UserVerifyTest()
		STRING  sName;
		STRING  sPassword;
		INT	 bDone;
		INT	 nStatus;
		bDone = FALSE;
		WHILE bDone = FALSE DO
				FormNew("@(Login Form)", 30, 5, 5);
				FormInput(1, 0, "@(Name)" + "   ", sName, 16);
				FormSecurePassword(1, 2, "@(Password)" + " ", sPassword, 16);
				FormButton( 1, 4, "  " + "@(OK)" + "  ", 0, 1);
				FormButton(17, 4, "@(Cancel)", 0, 2);
				IF FormRead(0) = 0 THEN
						IF UserVerify(sName, sSecurePassword) = 0 THEN
								bDone = TRUE;
								nStatus = 0;
								Message("Info", "Verification successful", 0)
						ELSE
								sPassword = "";
								Message("Info", "Verification not successful", 0)
						END

				ELSE
						bDone = TRUE;
						nStatus = 298;
				END
		END
		RETURN nStatus;
END

See Also

Security Functions