Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

SSMS <-> SMO Bug listing db_datareader role members

Offen
#44 7 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
csharp, sql
Bereich
database

Rechercherichtung

Beginne damit, das Datenbank-Setup aus dem Issue zu reproduzieren, und vergleiche die Ansicht der SMO/SSMS db_datareader-Rollenmitglieder mit sys.database_role_members. Überprüfe das im Object Explorer-Ausgabe angezeigte SQL und den Einstiegspunkt DBRoleProp; abgeschlossen ist die Aufgabe, wenn verschachtelte Rollenmitgliedschaften konsistent mit den Abfrageergebnissen angezeigt werden.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

@shueybubbles Ran into this Friday night during a production deploy that re-organized permissions... Came up with a simple repro:

Try the following database:

CREATE DATABASE [Test]
GO

USE [Test]
GO

CREATE ROLE Readers
GO

ALTER ROLE db_datareader ADD MEMBER [Readers]
GO

CREATE USER [MYDOMAIN\michael.miller] WITHOUT LOGIN
GO

ALTER ROLE Readers ADD MEMBER [MYDOMAIN\michael.miller]
GO

/* Output Table formatted with GitHub Markdown below */
SELECT * FROM sys.database_principals WHERE name = 'db_datareader'

/* Output Table formatted with GitHub Markdown below */
SELECT p.name FROM sys.database_role_members rm 
JOIN sys.database_principals p ON rm.member_principal_id = p.principal_id
WHERE rm.role_principal_id = 16390
name principal_id type type_desc default_schema_name create_date modify_date owning_principal_id sid is_fixed_role authentication_type authentication_type_desc default_language_name default_language_lcid allow_encrypted_value_modifications
db_datareader 16390 R DATABASE_ROLE NULL 2003-04-08 09:10:42.363 2009-04-13 12:59:14.467 1 0x01050000000000090400000000000000000000000000000006400000 1 0 NONE NULL NULL 0
name
Readers

When I go into SSMS and right click on Properties for the db_datareader role, I see the following INCORRECT mappings that do not match the output of the last two queries above:

image

I think there may be a separate bug here, observable in SSMS but not sure what SMO calls SSMS is making (is there a way to force SSMS to log that to the telemetry window? Telemetry window doesn't have super detailed logging by default).

The SSMS "Output Window --> Object Explorer" output I get is:

[2021-01-11T11:05:14.2162761-05:00 End Query] URN:Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role 

                                   Elapsed time:10.7294 ms 

                                   Query: SELECT
                                   rl.name AS [Name],
                                   'Server[@Name=' + quotename(CAST(
                                           serverproperty(N'Servername')
                                          AS sysname),'''') + ']' + '/Database[@Name=' + quotename(db_name(),'''') + ']' + '/Role[@Name=' + quotename(rl.name,'''') + ']' AS [Urn],
                                   rl.principal_id AS [ID],
                                   CAST(CASE WHEN rl.principal_id > 16383 AND rl.principal_id < 16400 THEN 1 ELSE 0 END AS bit) AS [IsFixedRole]
                                   FROM
                                   sys.database_principals AS rl
                                   WHERE
                                   (rl.type = 'R')
                                   ORDER BY
                                   [Name] ASC

which produces the following output table:

Name Urn ID IsFixedRole
db_accessadmin Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_accessadmin'] 16385 1
db_backupoperator Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_backupoperator'] 16389 1
db_datareader Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_datareader'] 16390 1
db_datawriter Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_datawriter'] 16391 1
db_ddladmin Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_ddladmin'] 16387 1
db_denydatareader Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_denydatareader'] 16392 1
db_denydatawriter Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_denydatawriter'] 16393 1
db_owner Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_owner'] 16384 1
db_securityadmin Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='db_securityadmin'] 16386 1
public Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='public'] 0 0
Readers Server[@Name='---SCRUBBED---']/Database[@Name='Test']/Role[@Name='Readers'] 5 0

and the SSMS "Output Window -> Telemetry" output view has:

[2021-01-11T11:05:07.7326467-05:00] sql/ssms/explorerhierarchynode/buildchildren
                                    DataModel.Action.DurationInMilliseconds = 185.0194
                                    SQL.SSMS.ObjectExplorer.Entity = Server/DatabasesFolder
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:09.2765405-05:00] sql/ssms/explorerhierarchynode/buildchildren
                                    DataModel.Action.DurationInMilliseconds = 44.0064
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:11.3234256-05:00] sql/ssms/explorerhierarchynode/buildchildren
                                    DataModel.Action.DurationInMilliseconds = 3.982
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database/DatabaseSecurityFolder
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:12.6408375-05:00] sql/ssms/explorerhierarchynode/buildchildren
                                    DataModel.Action.DurationInMilliseconds = 0.538
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database/RolesFolder
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:14.2193114-05:00] sql/ssms/explorerhierarchynode/buildchildren
                                    DataModel.Action.DurationInMilliseconds = 27.0348
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database/DatabaseRolesFolder
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:16.9081278-05:00] sql/ssms/explorerhierarchynode/setupmenuparent
                                    DataModel.Action.DurationInMilliseconds = 0
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database/Role
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:16.9191466-05:00] sql/ssms/explorerhierarchynode/getmenuitems
                                    DataModel.Action.DurationInMilliseconds = 8.9941
                                    SQL.SSMS.ObjectExplorer.Entity = Server/Database/Role
                                    SQL.SSMS.ObjectExplorer.IsSqlDW = False
                                    SQL.SSMS.ObjectExplorer.ServerType = Standalone
[2021-01-11T11:05:21.8648667-05:00] /sql/ssms/dialog
                                    SQL.Dialog.Action = Invoke
                                    SQL.Dialog.Name = DBRoleProp

Vorherrschende Sprache
C#
Sterne
143
Forks
28
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/sqlmanagementobjects

Alle Issues in microsoft/sqlmanagementobjects

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.