User management
While users and groups can be interactively managed in the Workplace, some IT environments require to create or drop application users from command line, for example under control of an overall enterprise user management software.
The scripts below allow to control users from command line in an update safe way. They might however also be examined to find the necessary SQL commands to manage users by direct database instructions.
Controlling users by SQL Commands
If you decide not to use the scripts, but manage users directly by SQL commands, be aware the the required SQL commands may vary for different versions of BPS. Check the scripts for possible changes when upgrading to new versions.
Setting the PIN code in table t_users is optional, you may leave the column 0 or NULL when you dont have access to the BPS API to encrypt the PIN code. The user manager of the workplace will not be able to display the PIN code correctly in this case, otherwise the application should however work.
Adding a new user by script
The adduser script can be started from the command line in the BPS installation directory. Use this command to show usage:
bps adduser -h
This will show the usage of the script, for example as:
SYNOPSYS
bps adduser CONNECTSTRING ID PIN [OPTION]...
DESCRIPTION
This program adds a BPS user.
NOTES
- Enter the CONNECTSTRING for the bps owner as userid/pincode@connection.
- ID must be in the range 1 to 99999999, and not from an existing user.
- PIN must be in the range 0 to 99999999.
- NAME must be no longer than 35 characters.
- MNEMONIC must be no longer than 10 characters.
- PHONE must be no longer than 35 characters.
- EMAIL must be no longer than 60 characters.
EXAMPLES
Create user with ID=6677, PIN=8899, NAME=John Miller and
MNEMONIC=jmill:
bps adduser 0/1234@prod 6677 8899 -n "John Miller" -m jmill
Create user and assign groups:
bps adduser 0/1234@prod 11 32 -n "Jim" -m jim -g "Mobile,MDE Stock"
OPTIONS
-h, --help
Show help (this).
-n NAME, --name=NAME
The full name, up to 35 characters.
-m MNEMONIC, --mnemonic=MNEMONIC
Shorthand logogram, up to 10 characters.
-p PHONE, --phone=PHONE
The phone number, up to 35 characters.
-e EMAIL, --email=EMAIL
The email address, up to 60 characters.
-g GROUPS, --groups=GROUPS
A comma separated name list of the groups to assign to the user.
Note that the adduser script needs to be run by the application owner, otherwise there are insufficient database privileges to complete the operations.
Modifying an existing user by script
The moduser script can be started from the command line in the BPS installation directory. Use this command to show usage:
bps moduser -h
This will show the usage of the script, for example as:
SYNOPSYS
bps moduser CONNECTSTRING ID [OPTION]...
DESCRIPTION
This program modifies a BPS user.
NOTES
- Enter the CONNECTSTRING for the bps owner as userid/pincode@connection.
- ID must be in the range 1 to 99999999 and from an existing user.
- PIN must be in the range 0 to 99999999.
- NAME must be no longer than 35 characters.
- MNEMONIC must be no longer than 10 characters.
- PHONE must be no longer than 35 characters.
- EMAIL must be no longer than 60 characters.
EXAMPLES
Change PIN of user 6677:
bps moduser 0/1234@prod 6677 -P 5467
Assign new set of groups to user 11:
bps moduser 0/1234@prod 11 -g "Mobile,MDE Stock,MDE Ad Hoc"
OPTIONS
-h, --help
Show help (this).
-P PIN, --pin=PIN
New PIN code in the range 0 to 99999999.
-n NAME, --name=NAME
New full name, up to 35 characters.
-m MNEMONIC, --mnemonic=MNEMONIC
New shorthand logogram, up to 10 characters.
-p PHONE, --phone=PHONE
New phone number, up to 35 characters.
-e EMAIL, --email=EMAIL
New email address, up to 60 characters.
-g GROUPS, --groups=GROUPS
New list of names of the groups to assign to the user.
Note that the adduser script needs to be run by the application owner, otherwise there are insufficient database privileges to complete the operations.
Removing an existing user by script
The dropuser script can be started from the command line in the BPS installation directory. Use this command to show usage:
bps dropuser -h
This will show the usage of the script, for example as:
SYNOPSYS
bps dropuser CONNECTSTRING ID [OPTION]...
DESCRIPTION
This program drops a BPS user.
NOTES
- Enter the CONNECTSTRING for the bps owner as userid/pincode@connection.
- ID must be in the range 1 to 99999999, from an existing user.
EXAMPLE
Drop user with ID=6677:
bps dropuser 0/1234@prod 6677
OPTIONS
-h, --help
Show help (this).
Note that the dropuser script needs to be run by the application owner, otherwise there are insufficient database privileges to complete the operation.
