36.15. Editing Object Privileges

Each PostgreSQL object (a table, view, index, or sequence) has an owner, who is the user who created it. By default, only the owner can select data from or update records in an object, which is not too useful if your server has multiple users who will all need access to the same tables. Fortunately, it is possible to grant access to database objects to other users or groups by following these steps:

1.
On the module's main page, click on the Granted Privileges icon. Assuming you actually have some tables in your databases, this will bring up a page listing all existing objects and their current permissions.

2.
Click on the name of the object to which you want to grant access, which will take you to its privileges editing form.

Hit the Save button at the bottom of the page to make the new permissions active.

The Grant privileges to table lists all users and groups to whom access has been granted, followed by a blank row for adding a new user or group. Most of the time, however, it will just contain that one empty row.

In the User column, select the name of the user or group to whom to grant privileges from the menu, or choose Everyone to grant access to all PostgreSQL users.

In the Privileges column, check the boxes for the rights that should be granted to the chosen user or group. The available options are their meanings are:

SELECT When checked, the user will be able to view records in this table or view with an SQL SELECT query.

UPDATE When chosen, this option gives users the ability to update existing records in the table.

INSERT This option gives users the right to add new records to the table with an SQL INSERT statement.

DELETE When checked, the user will be able to delete existing records from the table.

RULE Allows the user to create rules on the table or view. A rule is a piece of SQL code that is executed to transform data inserted, updated, or deleted in the table.

REFERENCES Allows the user to create a field that references this table as a foreign key.

TRIGGER When checked, the user will be able to create triggers for this table.

Because the table only displays one empty row at a time, you will need to save and re-edit the object permissions if you want to grant access to more than one user. If several users are to be given the same permissions, it is better to put them in a group and grant access to the group, instead.

Unlike MySQL, there is no way to give a user access to an entire database, or just to a field within a table. All privileges are granted at the table level only.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.17.157.190