@@ -179,7 +179,7 @@ func (d *serverRolePrincipalSyncer) Grants(ctx context.Context, resource *v2.Res
179179 return nil , "" , nil , err
180180 }
181181
182- grantOpts , err := BuildBatonIDGrantOptions (principalID , principal )
182+ grantOpts , err := BuildBatonIDGrantOptions (principalID , principal . Type , principal . Name )
183183 if err != nil {
184184 return nil , "" , nil , err
185185 }
@@ -201,10 +201,10 @@ func (d *serverRolePrincipalSyncer) Grants(ctx context.Context, resource *v2.Res
201201 return ret , npt , nil , nil
202202}
203203
204- func BuildBatonIDGrantOptions (principalID * v2.ResourceId , principal * mssqldb. RolePrincipalModel ) ([]grTypes.GrantOption , error ) {
204+ func BuildBatonIDGrantOptions (principalID * v2.ResourceId , principalType string , principalName string ) ([]grTypes.GrantOption , error ) {
205205 grantOpts := []grTypes.GrantOption {}
206206
207- switch principal . Type {
207+ switch principalType {
208208 case "G" : // Configure BatonID matching for Active Directory groups
209209 gr := & v2.Resource {
210210 Id : principalID ,
@@ -220,7 +220,7 @@ func BuildBatonIDGrantOptions(principalID *v2.ResourceId, principal *mssqldb.Rol
220220 grTypes .WithAnnotation (& v2.ExternalResourceMatch {
221221 ResourceType : v2 .ResourceType_TRAIT_GROUP ,
222222 Key : "downlevel_logon_name" ,
223- Value : principal . Name ,
223+ Value : principalName ,
224224 }),
225225 grTypes .WithAnnotation (& v2.GrantExpandable {
226226 EntitlementIds : []string {bidEnt },
@@ -232,7 +232,7 @@ func BuildBatonIDGrantOptions(principalID *v2.ResourceId, principal *mssqldb.Rol
232232 grTypes .WithAnnotation (& v2.ExternalResourceMatch {
233233 ResourceType : v2 .ResourceType_TRAIT_USER ,
234234 Key : "downlevel_logon_name" ,
235- Value : principal . Name ,
235+ Value : principalName ,
236236 }),
237237 )
238238 }
0 commit comments