Objects Accessible by a Login / User

  • Dear All,

    Do we have any commands or workarounds to find out the list of objects whether a particular user is having rights on it?

    Or in other way

    For a particular user what are the objects and what kind of permission he is having...

    Can anyone please help....

  • Hi, This one is good. But to find out this i need to login using that specific id and execute this query which is difficult for a huge no of logins... Can you please help with someother way of finding the Objects having what kind of access rights for a specific login.

    Please help...:crying:

  • It's going to be a huge mess in any case. The dump of permissions for objects for users is a huge amount of data, and it's impossible to read. It's just too much information for almost any database.

    What is the purpose here? Are you just documenting this? Or storing it for an audit? If you're going to use it, you only want to see permissions for an object or user/role, one at a time.

  • Also, you can use SETUSER to run this for any login, and then REVERT back to your user. Add a script around that and you can easily get all permissions.

  • --This script will generate all user permissions and the code to

    recreate them as required.

    SELECT C.name 'Schema',

    B.name AS Object,

    D.name username,

    A.type permissions_type,

    A.permission_name,

    A.state permission_state,

    A.state_desc,

    state_desc

    + ' ' + permission_name

    + ' ON ['+ C.name

    + '].[' + B.name + '] to ['

    + D.name

    + ']' COLLATE LATIN1_General_CI_AS AS

    Generated_Code

    FROM sys.database_permissions AS A JOIN sys.objects AS B ON

    A.major_id =

    B.object_id

    JOIN sys.schemas AS C ON B.schema_id =

    C.schema_id

    JOIN sys.database_principals AS D ON

    A.grantee_principal_id = D.principal_id

    ORDER BY 1, 2, 3, 5

    MJ

  • This helps! Thks a lot!

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply