// DeleteUser removes a user from the Authorize. ErrMissingUser is returned if
// the user to be deleted isn't found.
19878
func (a Authorizer) DeleteUser(username string) error {
	err := a.backend.DeleteUser(username)
	if err != nil && err != ErrDeleteNull {
		return mkerror(err.Error())
	}
	return err
}
285217
func (u *UserCommand) Delete(client auth.ClientI) error {
	for _, l := range strings.Split(u.login, ",") {
		if err := client.DeleteUser(l); err != nil {
			return trace.Wrap(err)
		}
		fmt.Printf("User '%v' has been deleted\n", l)
	}
	return nil
}
154254
func (ip *Interpreter) deleteUser(args []string) {
	ip.simpleResponder(ip.Backend.DeleteUser(args[0]))
}
682133
func (c *ExampleService) DeleteUser(ctx context.Context, id platform.ID) error {
	err := c.kv.Update(func(tx Tx) error {
		return c.deleteUser(ctx, tx, id)
	})

	if err != nil {
		return &platform.Error{
			Op:  "kv/" + platform.OpDeleteUser,
			Err: err,
		}
	}

	return nil
}
820828
func (a adminAPIHandlers) RemoveUser(w http.ResponseWriter, r *http.Request) {
	ctx := newContext(r, w, "RemoveUser")

	objectAPI := validateAdminReq(ctx, w, r)
	if objectAPI == nil {
		return
	}

	// Deny if WORM is enabled
	if globalWORMEnabled {
		writeErrorResponseJSON(ctx, w, errorCodes.ToAPIErr(ErrMethodNotAllowed), r.URL)
		return
	}

	vars := mux.Vars(r)
	accessKey := vars["accessKey"]
	if err := globalIAMSys.DeleteUser(accessKey); err != nil {
		writeErrorResponseJSON(ctx, w, toAdminAPIErr(ctx, err), r.URL)
	}
}
831096
func (s *Service) DeleteUser(ctx context.Context, id platform.ID) error {
	if _, err := s.FindUserByID(ctx, id); err != nil {
		return &platform.Error{
			Err: err,
			Op:  OpPrefix + platform.OpDeleteUser,
		}
	}
	s.userKV.Delete(id.String())
	return nil
}
427836
func (clnt *Client) DropUser(policy *AdminPolicy, user string) error {
	policy = clnt.getUsableAdminPolicy(policy)

	command := newAdminCommand(nil)
	return command.dropUser(clnt.cluster, policy, user)
}
323066
func (s *inmem) DeleteUser(ctx context.Context, id platform.ID) error {
	return s.delete(ctx, id, getUser)
}
1219362
func (s *witServiceImpl) DeleteUser(ctx context.Context, username string) error {
	log.Info(ctx, map[string]interface{}{"username": username}, "deleting user on WIT service")
	// this endpoint is restricted to the `auth` Service Account
	remoteWITService, err := s.createClientWithContextSigner(ctx)
	if err != nil {
		return err
	}
	deleteUserAPIPath := witservice.DeleteUsersPath(username)
	res, err := remoteWITService.DeleteUsers(goasupport.ForwardContextRequestID(ctx), deleteUserAPIPath)
	if err != nil {
		return err
	}
	defer rest.CloseResponse(res)
	bodyString := rest.ReadBody(res.Body) // To prevent FDs leaks
	if res.StatusCode != http.StatusOK {
		log.Error(ctx, map[string]interface{}{
			"username":        username,
			"response_status": res.Status,
			"response_body":   bodyString,
		}, "unable to delete user in WIT")
		return errors.Errorf("unable to delete user in WIT. Response status: %s. Response body: %s", res.Status, bodyString)
	}
	return nil
}
706837
func (m *Manager) DeleteUserGrant(username, globalID string, grant Grant) error {
	return m.collection.Update(bson.M{"username": username, "globalid": globalID}, bson.M{"$pull": bson.M{"grants": grant}})
}
1044239
func (api *API) DeleteUserAccessRule(accessRuleID string) (*AccessRuleResponse, error) {
	return api.deleteAccessRule("/user", accessRuleID)
}
86742
func (user User) Delete() error {
	if !user.Exists() {
		return fmt.Errorf("auth: users without IDs cannot be deleted")
	}
	return user.manager.Delete(user.ID)
}
129245
func (state *UserState) RemoveUser(username string) {
	state.usernames.Del(username)
	// Remove additional data as well
	// TODO: Ideally, remove all keys belonging to the user.
	state.users.DelKey(username, "loggedin")
}
200653
func (c *Client) Delete(ctx context.Context, u *chronograf.User) error {
	res, err := c.Query(ctx, chronograf.Query{
		Command: fmt.Sprintf(`DROP USER "%s"`, u.Name),
	})
	if err != nil {
		return err
	}
	// The DROP USER statement puts the error within the results itself
	// So, we have to crack open the results to see what happens
	octets, err := res.MarshalJSON()
	if err != nil {
		return err
	}

	results := make([]struct{ Error string }, 0)
	if err := json.Unmarshal(octets, &results); err != nil {
		return err
	}

	// At last, we can check if there are any error strings
	for _, r := range results {
		if r.Error != "" {
			return fmt.Errorf(r.Error)
		}
	}
	return nil
}
1074469
func (r *AdminService) DeleteUser(userName string) *AdminDeleteUserCall {
	c := &AdminDeleteUserCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.userName = userName
	return c
}
885618
func (r *Client) DeleteActualOrgUser(uid uint) (StatusMessage, error) {
	var (
		raw   []byte
		reply StatusMessage
		err   error
	)
	if raw, _, err = r.delete(fmt.Sprintf("api/org/users/%d", uid)); err != nil {
		return StatusMessage{}, err
	}
	err = json.Unmarshal(raw, &reply)
	return reply, err
}
459194
func (s *Service) RemoveUser(w http.ResponseWriter, r *http.Request) {
	ctx := r.Context()
	idStr := httprouter.GetParamFromContext(ctx, "id")
	id, err := strconv.ParseUint(idStr, 10, 64)
	if err != nil {
		Error(w, http.StatusBadRequest, fmt.Sprintf("invalid user id: %s", err.Error()), s.Logger)
		return
	}

	u, err := s.Store.Users(ctx).Get(ctx, chronograf.UserQuery{ID: &id})
	if err != nil {
		Error(w, http.StatusNotFound, err.Error(), s.Logger)
		return
	}
	if err := s.Store.Users(ctx).Delete(ctx, u); err != nil {
		Error(w, http.StatusBadRequest, err.Error(), s.Logger)
		return
	}

	w.WriteHeader(http.StatusNoContent)
}