| 22 | ) |
| 23 | |
| 24 | func (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. |
| 45 | func (dbc *DatabaseContext) UpdatePrincipal(ctx context.Context, updates *auth.PrincipalConfig, isUser bool, allowReplace bool) (replaced bool, princ auth.Principal, err error) { |