MCPcopy
hub / github.com/apache/casbin / DeleteUserCtx

Method DeleteUserCtx

rbac_api_context.go:58–71  ·  view source on GitHub ↗

DeleteUserCtx deletes a user with context support. Returns false if the user does not exist (aka not affected).

(ctx context.Context, user string)

Source from the content-addressed store, hash-verified

56// DeleteUserCtx deletes a user with context support.
57// Returns false if the user does not exist (aka not affected).
58func (e *ContextEnforcer) DeleteUserCtx(ctx context.Context, user string) (bool, error) {
59 var err error
60 res1, err := e.RemoveFilteredGroupingPolicyCtx(ctx, 0, user)
61 if err != nil {
62 return res1, err
63 }
64
65 subIndex, err := e.GetFieldIndex("p", constant.SubjectIndex)
66 if err != nil {
67 return false, err
68 }
69 res2, err := e.RemoveFilteredPolicyCtx(ctx, subIndex, user)
70 return res1 || res2, err
71}
72
73// DeleteRoleCtx deletes a role with context support.
74// Returns false if the role does not exist (aka not affected).

Callers

nothing calls this directly

Calls 3

GetFieldIndexMethod · 0.45

Tested by

no test coverage detected