checkUserAPIReadOnlyFields will return true if read only user fields are unchanged, else false. If a read only field is unchanged it will nil the field so the update to principle ignores it.
(newInfo auth.PrincipalConfig, user auth.User)
| 2380 | // checkUserAPIReadOnlyFields will return true if read only user fields are unchanged, else false. If a read only field |
| 2381 | // is unchanged it will nil the field so the update to principle ignores it. |
| 2382 | func checkUserAPIReadOnlyFields(newInfo auth.PrincipalConfig, user auth.User) (auth.PrincipalConfig, bool) { |
| 2383 | if newInfo.JWTIssuer != nil { |
| 2384 | if *newInfo.JWTIssuer != user.JWTIssuer() { |
| 2385 | return newInfo, false |
| 2386 | } |
| 2387 | newInfo.JWTIssuer = nil |
| 2388 | } |
| 2389 | if len(newInfo.JWTRoles) > 0 { |
| 2390 | userJWTRoles := user.JWTRoles().AsSet() |
| 2391 | if !newInfo.JWTRoles.Equals(userJWTRoles) { |
| 2392 | return newInfo, false |
| 2393 | } |
| 2394 | newInfo.JWTRoles = nil |
| 2395 | } |
| 2396 | if len(newInfo.JWTChannels) > 0 { |
| 2397 | userJWTChan := user.JWTChannels().AsSet() |
| 2398 | if !newInfo.JWTChannels.Equals(userJWTChan) { |
| 2399 | return newInfo, false |
| 2400 | } |
| 2401 | newInfo.JWTChannels = nil |
| 2402 | } |
| 2403 | return newInfo, true |
| 2404 | } |
| 2405 | |
| 2406 | // auditDbAuditEnabled writes any audit events for changes in whether db auditing is enabled |
| 2407 | func auditDbAuditEnabled(ctx context.Context, dbName string, previousEnabled, newEnabled bool, events []uint) { |
no test coverage detected