dbTalk Databases Forums  

Permissions for all users for all databases

microsoft.public.sqlserver.server microsoft.public.sqlserver.server


Discuss Permissions for all users for all databases in the microsoft.public.sqlserver.server forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
tolcis
 
Posts: n/a

Default Permissions for all users for all databases - 08-26-2009 , 07:59 AM






Hi,

I was trying to get a list of all users that have the access to the
particular SQL Server installces and their permissions + those user's
permissions on each of the databases.
This is what I got so far:
SELECT srprin.NAME, srprin.type_desc, srperm.class_desc,
srperm.permission_name
FROM sys.server_principals srprin INNER JOIN sys.server_permissions
srperm ON srprin.principal_id = srperm.grantee_principal_id

However, it doesn't show me user's mappings (rights on each
database). What else am I missing?

T.

Reply With Quote
  #2  
Old   
Carlos Sacristan
 
Posts: n/a

Default Re: Permissions for all users for all databases - 08-26-2009 , 09:21 AM






Did you check sp_helprotect?

--
-----------------------------
"Caminar sobre el agua y desarrollar software a partir de unas
especificaciones es fácil, si ambas están congeladas."
Edward V. Berard, ingeniero informático

http://blogs.solidq.com/es/elrincondeldba


"tolcis" <nytollydba (AT) gmail (DOT) com> wrote

Quote:
Hi,

I was trying to get a list of all users that have the access to the
particular SQL Server installces and their permissions + those user's
permissions on each of the databases.
This is what I got so far:
SELECT srprin.NAME, srprin.type_desc, srperm.class_desc,
srperm.permission_name
FROM sys.server_principals srprin INNER JOIN sys.server_permissions
srperm ON srprin.principal_id = srperm.grantee_principal_id

However, it doesn't show me user's mappings (rights on each
database). What else am I missing?

T.

Reply With Quote
  #3  
Old   
Tibor Karaszi
 
Posts: n/a

Default Re: Permissions for all users for all databases - 08-26-2009 , 09:45 AM



That information is stored *inside* each database
(sys.database_principals), so you can't retrieve it with one single
SELECT statement. You can write your own cursor to loop over each
database, or possibly use sp_MSForeachdatabase (not documented - use
at own risk), or some other mechanism.

--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi


"tolcis" <nytollydba (AT) gmail (DOT) com> wrote

Quote:
Hi,

I was trying to get a list of all users that have the access to the
particular SQL Server installces and their permissions + those
user's
permissions on each of the databases.
This is what I got so far:
SELECT srprin.NAME, srprin.type_desc, srperm.class_desc,
srperm.permission_name
FROM sys.server_principals srprin INNER JOIN sys.server_permissions
srperm ON srprin.principal_id = srperm.grantee_principal_id

However, it doesn't show me user's mappings (rights on each
database). What else am I missing?

T.

Reply With Quote
  #4  
Old   
Russell Fields
 
Posts: n/a

Default Re: Permissions for all users for all databases - 08-26-2009 , 10:51 AM



tolcis,

One additional hint. The sp_helplogins stored procedure will show a login
and its user roles on all databases to which it has access. This is often
useful and IF you only grant rights to database roles it may give you enough
detail. But, if you need more then Tibor has described what you should do.

FWIW,
RLF

"tolcis" <nytollydba (AT) gmail (DOT) com> wrote

Quote:
Hi,

I was trying to get a list of all users that have the access to the
particular SQL Server installces and their permissions + those user's
permissions on each of the databases.
This is what I got so far:
SELECT srprin.NAME, srprin.type_desc, srperm.class_desc,
srperm.permission_name
FROM sys.server_principals srprin INNER JOIN sys.server_permissions
srperm ON srprin.principal_id = srperm.grantee_principal_id

However, it doesn't show me user's mappings (rights on each
database). What else am I missing?

T.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.