Previous Topic

Next Topic

Book Contents

Book Index

SetPermUser - MaxBasic Function

SetPermUser(NewUserCode: String, Password:String) : OldUserCode

Sets the User Code for permissions within the executing encrypted script, for example where elevated permissions are wanted for event scripts. Returns the old Permission User Code.

If the NewUserCode is invalid, an exception message is displayed. The Permission User Code is reset on script completion to the logged in user.

SetPermUser function can only be called in an encrypted script (.pfz extension).

Saving (and encrypting) and Loading (and decrypting) encrypted scripts in the script editor requires Write permission for Company > Scripts > Encrypted, in addition other scripting permissions.

Executing encrypted scripts requires at least Read permission for Company > Scripts > Encrypted, in addition other scripting permissions.

SetPermUser function syntax has these named arguments:

Parameter

Description

New User Code

Required. The User Code to set as the Permission User.

Returns the previous Permission User.

Password

Required. The password for the Permission User.

Example use:

OldPermUser = SetPermUser("ACCREDO", "ACCREDO")

try

msgbox("OldPermUser:" & OldPermUser & ", CurrentPermUser:" & GetPermUser)

Dim datARCust as Object

datARCust = CreateObject("Accredo.ARCustomerData")

Print datARCust.Balance1

finally

SetPermUser(OldPermUser, "")

end try