(db *db.DatabaseContext, domain base.UserIDDomain)
| 866 | } |
| 867 | |
| 868 | func needRolesForAudit(db *db.DatabaseContext, domain base.UserIDDomain) bool { |
| 869 | // early returns when auditing is disabled |
| 870 | if db == nil || |
| 871 | db.Options.LoggingConfig == nil || |
| 872 | db.Options.LoggingConfig.Audit == nil || |
| 873 | !db.Options.LoggingConfig.Audit.Enabled { |
| 874 | return false |
| 875 | } |
| 876 | |
| 877 | // if we have any matching domains then we need the given roles |
| 878 | // this loop should be ~free for len(0) |
| 879 | for principal := range db.Options.LoggingConfig.Audit.DisabledRoles { |
| 880 | if principal.Domain == string(domain) { |
| 881 | return true |
| 882 | } |
| 883 | } |
| 884 | |
| 885 | return false |
| 886 | } |
| 887 | |
| 888 | // getSGUserRolesForAudit returns a list of role names for the given user, if audit role filtering is enabled. |
| 889 | func getSGUserRolesForAudit(db *db.DatabaseContext, user auth.User) ([]string, error) { |
no outgoing calls
no test coverage detected