views:

351

answers:

5

Is there a way I can give developers permission to grant a user permissions over objects without giving them the option to create users or functions?

I'm trying to limit developers permissions, I recently found out that developers had db_owner permissions in dev and prod environments! So I'm doing my best to stop this madness.

Any good article about this matter?

+1  A: 

If someone can give someone else permissions, he can also give himself the permission to do what he wants. So what is this good for? Probably I don't understand your situation.

Stefan Steinegger
Thats not correct. WITH GRANT helps doing stuff like that in sql server. Thats why I'm asking, i'm hoping there would be a way of achieving what i want.
Alan FL
+3  A: 

You can make them members of the "db_securityadmin" database role

Jose Basilio
I have thought of doing this, but db_securityadmin has some permissions i'd like them not to have.
Alan FL
A: 

As Stefan said, giving them grant permissions would effectively give them all permissions, since if they want to do something all they have to do is grant themselves the permissions to do it.

Rather than considering the developers the enemy, though, you may want to consider giving the developers a second user account that's used to administer the database. It's pretty common not to give developers ANY permissions to production, at least on their development account.

Adam Robinson
+2  A: 

As said, if someone could hand out permissions, they could hand out permissions to themselves (or a dummy account). I'm not sure if there is a trick in SQL Server to provide "give user permissions less then me".

The way I would do it is with stored procedures.

Create a stored procedure that gives a specified user a specific right or set of rights (those rights are the ones that regular users are allowed to have). Then give the developers execute access to this stored procedure. In effect you use stored procedures to create a limited version of GRANT, while keeping the full GRANT command to yourself.

David
nice, i didn't think about that option. Thank you, i'll give it a try.
Alan FL
+1  A: 

Owners of objects can grant permissions on those objects. Provided your developers don't need to grant things like CREATE TABLE rights, you might be able to give them ownership of the objects that you want them to grant permission on.

Ryan Brunner