MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / needRolesForAudit

Function needRolesForAudit

rest/handler.go:868–886  ·  view source on GitHub ↗
(db *db.DatabaseContext, domain base.UserIDDomain)

Source from the content-addressed store, hash-verified

866}
867
868func 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.
889func getSGUserRolesForAudit(db *db.DatabaseContext, user auth.User) ([]string, error) {

Callers 2

getCBUserRolesForAuditFunction · 0.85
getSGUserRolesForAuditFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected