Prev | What's New in Pervasive.SQL V8.5 | Next |
Creating Database Users and Privileges
This section explains how to create users and assign privileges for databases. User accounts and associated file or table privileges can be created by two different methods:
You must be logged into the database as Master before you can create users or assign privileges by either method.
Note
If your database uses Mixed security, you must create database user names that are the same as the operating system user names used to login to the computer where the database engine is installed.
General Tasks
To log into a database using PCC when you are already logged into that database as another user
Note
As the Master user, logging in as another user can aid you in testing the more restrictive permissions you have assigned this user.
- Click on the machine name in the PCC namespace
- Click the F5 button (Refresh). This clears all open connections.
- Select the database again and you will be prompted to log in.
Creating Database Users
To create a new user with SQL statements
- In PCC, right-click on the database you wish to work with. From the pop-up menu, select Tasks 4 Execute SQL Query to open SQL Data Manager (SQL DM).
- In SQL DM (or your selected SQL interface, such as ODBC Test), enter the following query and run it:
where myuser is the user name you wish to create, and mypass is the password for that user. For example, to create the user 'john' with password 'jb456', you would enter the following syntax:
GRANT LOGIN TO john:jb456You have now created a new database user account. To assign privileges for this user, see Assigning Permissions .
To create a new user with PCC and assign permissions
- Log into your secure database as the Master user.
- Right-click on the Users node for a database.
- Select New User
Figure 4-6 Creating a New Database User With PCC
- If you want this new user to inherit the permissions from a group instead of having individual permissions, you should first define a group. You cannot add a user to a group other than at the time of the user's creation. If you do not assign a group, this new user still inherits the permissions of the PUBLIC group. No user can have permissions that are lower than PUBLIC. Select the checkbox that corresponds to the group and click OK.
Figure 4-7 Entering a New User
- If you want the user to have individual permissions, click the Permissions tab when you see Figure 4-7 and specify individual permissions by selecting the checkbox next to the database or table right you want to add.
Figure 4-8 Assigning a User's PermissionsThe Database Rights section grants that right to all tables in the database. The lower part of the dialog allows you to specify rights specifically by table. In the example shown in Figure 4-8, the user Joe has Update rights to all the tables, and Insert rights to only the Customer and Employees tables.
The following SQL statements would produce the same results as the selections in Figure 4-8:
GRANT Insert on Customers to Joe#
GRANT Insert on Employees to Joe#
- It is also important to note that Joe could also inherit rights from the default group PUBLIC that you could not see in Figure 4-8. To see all of a user's potential rights, you need to look at both the user's properties and that of PUBLIC.
Figure 4-9 Rights Assigned to PUBLIC GroupIn this case, PUBLIC also has Select rights to all tables, so user 'Joe' has Select and Update rights on all tables, based on his combined individual and PUBLIC rights.
Assigning Permissions
To assign a user table privilege using SQL statements
- In SQL DM or your selected SQL interface, enter the following statement to assign privileges for an existing user:
- GRANT privilege ON table to user
To assign default permissions for a specific user
- Create a user as described in To create a new user with PCC and assign permissions but do not assign any specific permissions.
- The permissions assigned to the group PUBLIC will be enforced for the user.
To assign default permissions for all users
- Using PCC, Click the Users node for the secure database.
- Right-click PUBLIC and select Properties.
- Click the Permissions tab.
- Assign the database or table permissions for PUBLIC using the checkboxes as shown in Figure 4-9 . Any right that is not checked is not granted to default new users.
Prev Configuring Security |
Contents Up Check for Revisions | Next Security Issues |