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

Method getRoleInfo

rest/admin_api.go:2006–2031  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2004}
2005
2006func (h *handler) getRoleInfo() error {
2007 h.assertAdminOnly()
2008 name := mux.Vars(h.rq)["name"]
2009 role, err := h.db.Authenticator(h.ctx()).GetRole(name)
2010 if role == nil {
2011 if err == nil {
2012 err = kNotFoundError
2013 }
2014 return err
2015 }
2016 // If not specified will default to false
2017 includeDynamicGrantInfo := h.permissionsResults[PermReadPrincipalAppData.PermissionName]
2018 info, err := marshalPrincipal(h.db, role, includeDynamicGrantInfo)
2019 if err != nil {
2020 return err
2021 }
2022 b, err := base.JSONMarshal(info)
2023 if err == nil {
2024 base.Audit(h.ctx(), base.AuditIDRoleRead, base.AuditFields{
2025 "db": h.db.Name,
2026 "role": name,
2027 })
2028 }
2029 h.writeRawJSON(b)
2030 return err
2031}
2032
2033func (h *handler) getUsers() error {
2034

Callers

nothing calls this directly

Calls 8

assertAdminOnlyMethod · 0.95
ctxMethod · 0.95
writeRawJSONMethod · 0.95
JSONMarshalFunction · 0.92
AuditFunction · 0.92
marshalPrincipalFunction · 0.85
GetRoleMethod · 0.80
AuthenticatorMethod · 0.45

Tested by

no test coverage detected