Skip to content

Get-DbaUserPermission misses database role assignments #4887

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pagerwho opened this issue Dec 31, 2018 · 1 comment · Fixed by #5222
Closed

Get-DbaUserPermission misses database role assignments #4887

pagerwho opened this issue Dec 31, 2018 · 1 comment · Fixed by #5222

Comments

@pagerwho
Copy link
Contributor

Within the Get-DbaUserPermission.ps1 file it appears that the alias is missing from the third value of the $dbSQL resultset which causes the RoleSecureableClass to appear blank. I was able to confirm this issue exists in version 0.732. This issue was confirmed corrected by adjusting the T-SQL as below:

SELECT 'DB ROLE MEMBERS' AS type , Member , ISNULL(Role, 'None') AS [Role/Securable/Class] , --INSERTED PROPER ALIAS HERE ' ' AS [Schema/Owner] , ' ' AS [Securable] , ' ' AS [Grantee Type] , ' ' AS [Grantee] , ' ' AS [Permission] , ' ' AS [State] , ' ' AS [Grantor] , ' ' AS [Grantor Type] , ' ' AS [Source View] FROM tempdb.[STIG].[database_role_members] UNION SELECT DISTINCT 'DB SECURABLES' AS Type , ISNULL(drm.member, 'None') AS [Role/Securable/Class] , dp.[Securable Type or Class] COLLATE SQL_Latin1_General_CP1_CI_AS , dp.[Schema/Owner] , dp.Securable , dp.[Grantee Type] COLLATE SQL_Latin1_General_CP1_CI_AS , dp.Grantee , dp.Permission COLLATE SQL_Latin1_General_CP1_CI_AS , dp.State COLLATE SQL_Latin1_General_CP1_CI_AS , dp.Grantor , dp.[Grantor Type] COLLATE SQL_Latin1_General_CP1_CI_AS , dp.[Source View] FROM tempdb.[STIG].[database_role_members] drm LEFT JOIN tempdb.[STIG].[database_permissions] dp ON ( drm.member = dp.grantee OR drm.role = dp.grantee ) WHERE dp.Grantor IS NOT NULL AND [Schema/Owner] <> 'sys'

@stale
Copy link

stale bot commented Mar 1, 2019

This issue has been automatically marked as stale because it has not had recent activity. If you would like this issue to remain open:

  • Verify that you can still reproduce the issue in the latest version of dbatools
  • Comment that the issue is still reproducible and include:
    • What version of dbatools you reproduced the issue on
    • What OS and version you reproduced the issue on
    • What steps you followed to reproduce the issue

@stale stale bot added the wontfix label Mar 1, 2019
@wsmelton wsmelton added stale Stale Bot label used to identify issues that are no longer active and bot has closed them and removed wontfix labels Mar 17, 2019
@stale stale bot removed the stale Stale Bot label used to identify issues that are no longer active and bot has closed them label Mar 17, 2019
@wsmelton wsmelton removed the wontfix label Mar 17, 2019
potatoqualitee added a commit that referenced this issue Mar 17, 2019
potatoqualitee added a commit that referenced this issue Mar 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants