Home Forums Programming SMO/RMO/DMO What happens if a user tries to execute some SMO object when they have low priorities? RE: What happens if a user tries to execute some SMO object when they have low priorities?

  • Not necessarily a SELECT. It could be an RPC or other method of accessing the data, but the rights of the user apply. If you have rights to read data, such as the rights of a role, then you can access the data.

    Are you trying to determine what rights a particular role has? Whatever account the application has would need rights to access sys.objects, sys.database_principals, and sys.permissions if you want to query. This gets the object, permissions, and type of right. You would really want to add schema in here:
    SELECT TOP 10
      o.name,
      dpe.permission_name,
      dpe.state_desc
    FROM
      sys.database_principals dp
      INNER JOIN sys.database_permissions dpe
       ON dp.principal_id = dpe.grantee_principal_id
      INNER JOIN sys.objects o
       ON dpe.major_id = o.object_id
    WHERE dp.name = 'SalesUsers';