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

Method DeleteRole

db/users.go:24–42  ·  view source on GitHub ↗
(ctx context.Context, name string, purge bool)

Source from the content-addressed store, hash-verified

22)
23
24func (db *DatabaseContext) DeleteRole(ctx context.Context, name string, purge bool) error {
25 authenticator := db.Authenticator(ctx)
26
27 role, err := authenticator.GetRole(name)
28 if err != nil {
29 return err
30 }
31
32 if role == nil {
33 return base.ErrNotFound
34 }
35
36 seq, err := db.sequences.nextSequence(ctx)
37 if err != nil {
38 return err
39 }
40
41 return authenticator.DeleteRole(role, purge, seq)
42}
43
44// UpdatePrincipal updates or creates a principal from a PrincipalConfig structure.
45func (dbc *DatabaseContext) UpdatePrincipal(ctx context.Context, updates *auth.PrincipalConfig, isUser bool, allowReplace bool) (replaced bool, princ auth.Principal, err error) {

Callers 4

TestGetRoleIDsFunction · 0.45
TestRoleQueryFunction · 0.45
TestAllPrincipalIDsFunction · 0.45
TestGetRoleIDsFunction · 0.45

Calls 3

AuthenticatorMethod · 0.95
GetRoleMethod · 0.80
nextSequenceMethod · 0.80

Tested by 4

TestGetRoleIDsFunction · 0.36
TestRoleQueryFunction · 0.36
TestAllPrincipalIDsFunction · 0.36
TestGetRoleIDsFunction · 0.36