4D v13.4

Set user properties

Home

 
4D v13.4
Set user properties

Set user properties 


 

Set user properties ( userID ; name ; startup ; password ; nbLogin ; lastLogin {; memberships {; groupOwner}} ) -> Function result 
Parameter Type   Description
userID  Longint in Unique ID number of user account, or -1 for adding a user affiliated with the Designer, or -2 for adding a user affiliated with the Administrator
name  String in New user name
startup  String in Name of new user startup method
password  String in New (unencrypted) password, or * to leave the password unchanged
nbLogin  Longint in New number of logins to the database
lastLogin  Date in New date of last login to the database
memberships  Longint array in ID numbers of groups to which the user belongs
groupOwner  Longint in Reference number of user group owner
Function result  Longint in Unique ID number of new user

Set user properties lets you change and update the properties of an existing user account whose unique user ID number you pass in userID, or add a new user affiliated with the Designer or the Administrator.

If you are changing the properties of an existing user account, you must pass a valid user ID number returned by the GET USER LIST command.

If the user account does not exist or has been deleted, the error -9979 is generated. You can catch this error with an error-handling method installed using ON ERR CALL. Otherwise, you can call Is user deleted to test the user account before calling Set user properties.

User ID numbers can have the following values or ranges:

User ID number User description
1Designer user
2Administrator user
3 to 15000User created by the Designer of the database
(user #3 is the first user created by the Designer, user #4 the second, and so on).
-11 to -15000User created by the Administrator of the database
(user #-11 is the first user created by the Administrator, user #-12 is the second, and so on).

To add a new user affiliated with the Designer pass -1 in userID. To add a new user affiliated with the Administrator pass -2 in userID.
After the call, if the user is successfully added or modified, its unique ID number is returned in userID.

If you do not pass -1, -2 or a valid user ID number, Set user properties does nothing.

Before the call, you pass the new name, startup method, password, number of logins and date of last login for the user, in the name, startup, password, nbLogin and lastLogin parameters.You pass an unencrypted password in the password parameter. 4D will encrypt it for you before saving it in the user account.
If the new user name passed in name is not unique (there is already a user with the same name), the command does nothing and the error -9979 is returned. You can catch this error with an error-handling method installed using ON ERR CALL.

If you do not want to change all the properties of the user (aside from the memberships, see below), first call GET USER PROPERTIES and pass the returned values for the properties you want to leave unchanged.

If you do not want to change the password for an account, pass the * symbol as a value for the password parameter. This allows you to change the other properties of the user account without changing the password for the account.

If you do not pass the optional memberships parameter, the current memberships of the user are left unchanged. If you do not pass memberships when adding a user, the user will not belong to any group.
If you pass the optional memberships parameter, you change all the memberships for the user. Before the call, you must populate the memberships array with the unique ID numbers of the groups to which the user will belong.

If you pass the optional groupOwner parameter, you indicate the ID number of the user group “owner”, i.e. the default owner group of the objects created by this user.

The group ID numbers can be the following:

Group ID number Group description
15001 to 32767Group created by the Designer or affiliated Group Owner
(group #15001 is the first group created by the Designer, group #15002 the second, and so on).
-15001 to -32768Group created by the Administrator or affiliated Group Owner
(group #-15001 is the first group created by the Administrator, group #-15002 the second, and so on).

To revoke all the memberships of a user, pass an empty memberships array.

If you do not have the proper access privileges for calling Set user properties or if the Password system is already accessed by another process, an access privilege error is generated. You can catch this error with an error-handling method installed using ON ERR CALL.

 
PROPERTIES 

Product: 4D
Theme: Users and Groups
Number: 612

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D 2004

 
SEE ALSO 

DELETE USER
GET GROUP LIST
GET USER LIST
GET USER PROPERTIES
Is user deleted
Validate password