SQL – Grant Table Permissions

Marketing
Marketing
  • Updated

by David Crowther

DC_Pic_1.png

Question:

Is it possible to restrict a SQL User to only have Write permissions to specific Database Tables?

 

Answer:

Yes, this is possible, and it is a great way to ensure that only certain users can edit certain tables in your Spatial Database.

Firstly, create a new READ ONLY user in your Database e.g. NewUser… ensuring that you do this at Database level (Database > Security > Users) e.g. inside your Spatial GeoStore.

DC_pic_2.jpg

Once the New User has been created inside your chosen Database, in the Databases Security > Users section > select that User, right click and choose Properties.

DC_pic_3.jpg

This will open the Properties for the chosen User. From the left choose the Securables menu and this will list if the Database User has been restricted to certain permissions per TABLE. In the example below we have already added the Permissions for the NewUser to a table called asset_reponsibility.

DC_pic_4.jpg

To Add a new Permission, choose the SEARCH button in the Securables section.

DC_pic_5.jpg

In the Add Objects menu, choose Specific Objects and choose OK.

DC_pic_6.jpg

In the Select Objects window, choose the Object Types button…..

DC_pic_7.jpg

…. and from the list of Object Types tick the box to choose > Tables and click OK.

DC_pic_8.jpg

Back in the Select Objects window, type a name of a table e.g. Obsol… and then press the Check Names button.

DC_pic_9.jpg

If there are multiple Tables with that name, tick to choose the Tables you require and press OK.

DC_pic_10.jpg

Once you have selected the Database Objects, choose OK and the chosen Tables are added to the Securables section at the top of the User properties.

DC_pic_11.jpg

At the bottom of the Securables page are the Permissions for each Database Table. Select the added Table and then tick which permissions to grant as needed e.g. Delete, Insert, Select, Update.

DC_pic_12.jpg

Finally, press OK to the User properties and the change to their Permissions will take effect. This User will now be able to edit tables based on the Permissions you granted for that User.

 

Was this article helpful?

0 out of 0 found this helpful

Have more questions? Submit a request

Comments

0 comments

Please sign in to leave a comment.