Passwords

 

Remarks Properties Methods Events Samples

ED
avaliable
RT
avaliable

Remarks:Top

This object represents the user administration of the current project.
With this object new users can be created and existing users can be edited/deleted during online operation. These changes can be imported into the Editor with decompiling. See the documentation of the control system for further information on decompiling.
Users also can be logged in and out with this collection. Additionally this objects offers information on the currently logged in user.

A user login executes the event UserChange with which you can execute user defined actions.

Hint: For the event the object has to be defined with the attribute WithEvents in Visual Basic or VBA.

Properties:Top

CountUser LoggedUser LoggedUsername
Parent    

Methods:Top

CheckIn CheckOut CreateUser
CreateUserEx DeleteUser Export
Get Import IsCheckedOut
IsDifferent IsLocked ItemUser
Login LoginPassword Logoff
UndoCheckOut    

Events:Top

UserChange    

Samples:Top

Dim WithEvents zUserAdministration As Passwords

'initialize event on runtime startup
Private Sub Project_Active()
	Set zUserAdministration = thisProject.Passwords
End Sub

Private Sub zUserAdministration_UserChange()
	Debug.Print zUserAdministration.LoggedUser; " is logged in!"
End Sub

'create a new user
Sub CreateUser()
Dim zUser As User
	'12345 = Levels: 0,3,4,5,12,13
	Set zUser = thisProject.Passwords.CreateUser("Full Name", "Username", "P@ssword", 12345)
	With zUser
		.Active = True
		.Admin = True
		.Locked = False
	End With
End Sub

'change some user properties
Sub ChangeUser()
Dim zUser As User
Dim vResult As Variant

	Set zUser = thisProject.Passwords.ItemUser(0)
	Debug.Print zUser.Name & " will be changed"

	'change the identification of the user
	vResult = zUser.IdentificationChange("NewLogonName")

	'change the password for the user
	vResult = zUser.PasswordChange("P@ssword", "NewPassword")

End Sub

'login a user with its password...
Sub LoginUser()
Dim bResult As Boolean
	bResult = zUserAdministration.LoginPassword("LogonName", "P@ssword")
End Sub

'release objects on closing the runtime
Private Sub Project_Inactive()
	Set zUserAdministration = Nothing
End Sub