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

Function getAuditEventAccess

rest/admin_api.go:1890–1906  ·  view source on GitHub ↗
(db *db.Database, princ auth.Principal)

Source from the content-addressed store, hash-verified

1888}
1889
1890func getAuditEventAccess(db *db.Database, princ auth.Principal) map[string]map[string][]string {
1891 auditEventAccess := make(map[string]map[string][]string)
1892 if db.OnlyDefaultCollection() {
1893 collectionAccess := make(map[string][]string)
1894 collectionAccess[base.DefaultCollection] = princ.ExplicitChannels().AllKeys()
1895 auditEventAccess[base.DefaultScope] = collectionAccess
1896 } else {
1897 auditEventAccess = auth.GetExplicitCollectionChannelsForAuditEvent(princ.GetCollectionsAccess())
1898 // we support specifying both collection access and legacy way for default collection, if there are some channels
1899 // specified for default collection in legacy way, add them here
1900 defaultChannels := princ.ExplicitChannels().AllKeys()
1901 if db.HasDefaultCollection() && len(auditEventAccess[base.DefaultScope][base.DefaultCollection]) == 0 {
1902 auditEventAccess[base.DefaultScope][base.DefaultCollection] = defaultChannels
1903 }
1904 }
1905 return auditEventAccess
1906}
1907
1908// Handles PUT or POST to /_user/*
1909func (h *handler) putUser() error {

Callers 1

updatePrincipalMethod · 0.85

Calls 6

OnlyDefaultCollectionMethod · 0.80
AllKeysMethod · 0.80
HasDefaultCollectionMethod · 0.80
ExplicitChannelsMethod · 0.65
GetCollectionsAccessMethod · 0.65

Tested by

no test coverage detected