September 4, 2009 at 7:00 am
Hi
I'm trying to create a sql server login with limited permissions as follows:
1. Database1 - tables read only.
2. Database2 - GRANT Select / Insert / Delete data
3. Database2 - GRANT Create / Alter procedure (delete action not required)
4. Database2 - Execute all procedure/functions
5. Database2 - User should not alter the table structure.
With the above mentioned details, can I create a ROLE so that I can create multiple logins with the same access/limitations as mentioned above for different databases.
Kindly provide me the code.
Regards
Mohan Kumar VS
September 4, 2009 at 7:35 am
Mohan Kumar (9/4/2009)
HiI'm trying to create a sql server login with limited permissions as follows:
1. Database1 - tables read only.
2. Database2 - GRANT Select / Insert / Delete data
3. Database2 - GRANT Create / Alter procedure (delete action not required)
4. Database2 - Execute all procedure/functions
5. Database2 - User should not alter the table structure.
With the above mentioned details, can I create a ROLE so that I can create multiple logins with the same access/limitations as mentioned above for different databases.
Kindly provide me the code.
Regards
Mohan Kumar VS
yes you can create a role to do this. in fact you will need two separate roles. One for each database.
I find that BOL (Books online) is the best way of finding this information out.
--------------------------------------------------------------------------------------
[highlight]Recommended Articles on How to help us help you and[/highlight]
[highlight]solve commonly asked questions[/highlight]
Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
Managing Transaction Logs by Gail Shaw[/url]
How to post Performance problems by Gail Shaw[/url]
Help, my database is corrupt. Now what? by Gail Shaw[/url]
September 4, 2009 at 8:09 am
I'd agree that you need two roles.
Create a role in each db, then assign the permissions needed with the GRANT statement. If you don't grant rights, as in control of the schema or db_owner, the role will not be able to do things, like alter the tables.
September 4, 2009 at 9:34 am
i don't get to play with permissions much, so this post intrigued me;
does db_datareader automatically bring in EXECUTE permissions on views
or db_datawriter automatically bring in EXECUTE permissions on procs/functions?
can someone confirm that the OP requirements for needing CREATE/ALTER EXECUTE on all procs , but denying DDL to tables means you have to resolve this way?
If cannot give db_ddladmin to the role, would you instead loop thru every proc, and grant each individually?
would that allow him to create a proc that does not exist? or is it more correct to do the reverse, grant db_ddladmin , but then loop thru every table and explicitly DENY?
it seems like i'm missing something where i might expect to be able to do something at the "object type" level,
I've seen the GRANT VIEW ANY DEFINITION to allow people to see the DDL of views and procs.
it seems like the granularity is missing bewtween schema and individual objects, or am i missing the command on how todo it?like this:
DATABASE
--SCHEMA--
----{OBJECTTYPES?}
----INDIVIDUAL OBJECTS
is there a similar command like GRANT CREATE ANY PROCEDURE, or are you stuck looping thru objects
I looked in BOL, but the actual examples for GRANT EXECUTE all use objects, and no schemas
--1. Database1 - tables read only.
USE Database1
CREATE ROLE [ReallyReadOnly]
--give reader writes to this group
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [ReallyReadOnly]
--explicitly DENY access to writing
ALTER AUTHORIZATION ON SCHEMA::[DB_DenyDataWriter] TO [ReallyReadOnly]
--2. Database2 - GRANT Select / Insert / Delete data
USE Database2
CREATE ROLE [ProcWriter]
ALTER AUTHORIZATION ON SCHEMA::[db_datareader] TO [ProcWriter]
ALTER AUTHORIZATION ON SCHEMA::[db_datawriter] TO [ProcWriter]
--3. Database2 - GRANT Create / Alter procedure (delete action not required)
ALTER AUTHORIZATION ON SCHEMA::[db_ddladmin] TO [ProcWriter]
--4. Database2 - Execute all procedure/functions
--auto granted with datawriter?
--5. Database2 - User should not alter the table structure.
--loop thru all tables to "DENY ALTER ON [dbo].[eachtable] TO [ProcWriter]"
Lowell
September 5, 2009 at 2:49 am
I thank all of you for your help. I will try & let you know.
Rgds
Mohan Kumar VS
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply