DeleteUserCtx deletes a user with context support. Returns false if the user does not exist (aka not affected).
(ctx context.Context, user string)
| 56 | // DeleteUserCtx deletes a user with context support. |
| 57 | // Returns false if the user does not exist (aka not affected). |
| 58 | func (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). |
nothing calls this directly
no test coverage detected