Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GRANT Table Permissions for a limited amount of time

I have a plsql job that runs as a specific user, and I need to perform a grant to give this user access to specific tables until the job completes. The job never takes more than 30 minutes.

My question is, in oracle is there anyway to grant a specific user access to a table for a limited amount of time, or should I just create another function to revoke privileges after the job is complete? I did a few quick searches and was unable to find anything on this. Does anyone know if this is possible?

It would be awesome if I could do grant all for 30 minutes.

like image 319
user2133925 Avatar asked Jun 26 '15 14:06

user2133925


People also ask

How do I grant permission to a table in mysql?

To GRANT ALL privileges to a user , allowing that user full control over a specific database , use the following syntax: mysql> GRANT ALL PRIVILEGES ON database_name. * TO 'username'@'localhost';

How do I grant permissions in SQL?

Login to SQL Server Management Studio. In Object Explorer on the left pane, expand the Databases folder and select the concerned database and navigate to the by expanding Security and Users folders. Right-click the User to which you want to GRANT or REVOKE the permissions.


1 Answers

The comment from @ksa is the correct answer for this. You should create a new user with exactly the permissions required, and define this procedure on that schema. You can then GRANT EXECUTE on this procedure to the role or users that need to run it. Although it is the default, you can also explicitly specify AUTHID DEFINER. In essence this means the procedure runs as the definer no matter who calls it. It saves you from any timing/scheduling issues and the permissions are clear to your successors. If you don't like having to specify the schema on every call, you can define a synonym.

like image 163
AdamRossWalker Avatar answered Oct 01 '22 10:10

AdamRossWalker