I’m looking for a way to identify the default permissions granted to a user in a particular database. I have tried this:
select *
from dbc.allrights
where username='user-id'
and databasename='database-name'
There are two problems with the above; first, as written, the query returns one row for each permisison for each table owned by the user-id and it includes permissions that were specifically granted. Second, if the user-d has not created any tables at all, no rows are returned.
I’m hoping there is be another DBC view that contains the default permissions for a user and for a database.
Implicit rights at the database level would only exist if the user created the database themselves. Otherwise, implicit rights are at the object level within the database the created the object.
Explicit rights granted by the system or security admin are suggested to be managed at a role level. Role membership can be determined within the DBC.RoleMembers view. Access rights for a given role can be identified in the DBC.AllRoleRights. However, if my memory serves correctly, explicit rights granted at the database level to a user can be determined if you reference the psuedo-table ‘All’ in the DBC.AllRights view.