// Removes the user from an organization
325389
func (s *UsersService) LeaveOrganization(globalid, username string, headers, queryParams map[string]interface{}) (*http.Response, error) {
	var err error

	resp, err := s.client.doReqNoBody("DELETE", s.client.BaseURI+"/users/"+username+"/organizations/"+globalid+"/leave", headers, queryParams)
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()

	switch resp.StatusCode {
	case 404:
		var respBody404 Error
		err = goraml.NewAPIError(resp, &respBody404)
	default:
		err = goraml.NewAPIError(resp, nil)
	}

	return resp, err
}
275087
func (m *Manager) RemoveOrganization(globalID string, organization string) error {
	qry := bson.M{"globalid": globalID}
	update := bson.M{"$pull": bson.M{"orgowners": organization, "orgmembers": organization}}
	return m.collection.Update(qry, update)
}
733874
func (s *OrganizationService) DeleteOrganization(ctx context.Context, id platform.ID) error {
	return s.DeleteOrganizationF(ctx, id)
}
1058501
func (s *OrgService) DeleteOrganization(ctx context.Context, id influxdb.ID) error {
	if err := authorizeWriteOrg(ctx, id); err != nil {
		return err
	}

	return s.s.DeleteOrganization(ctx, id)
}
976083
func (st *State) removeModelUser(user names.UserTag) error {
	ops := removeModelUserOps(st.ModelUUID(), user)
	err := st.db().RunTransaction(ops)
	if err == txn.ErrAborted {
		err = errors.NewNotFound(nil, fmt.Sprintf("model user %q does not exist", user.Id()))
	}
	if err != nil {
		return errors.Trace(err)
	}
	return nil
}
420876
func (s *IdentityService) DeleteUser(user string) error {
	_, err := s.GetUser(user)
	if err != nil {
		return trace.Wrap(err)
	}
	startKey := backend.Key(webPrefix, usersPrefix, user)
	err = s.DeleteRange(context.TODO(), startKey, backend.RangeEnd(startKey))
	return trace.Wrap(err)
}
691829
func (api OrganizationsAPI) DeleteOrganizationRegistryEntry(w http.ResponseWriter, r *http.Request) {
	globalid := mux.Vars(r)["globalid"]
	key := mux.Vars(r)["key"]

	mgr := registry.NewManager(r)
	err := mgr.DeleteRegistryEntry("", globalid, key)

	if err != nil {
		log.Error(err.Error())
		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
		return
	}

	w.WriteHeader(http.StatusNoContent)
}
268700
func (o *OrgsClient) RemoveMember(ctx context.Context, orgID identity.ID,
	userID identity.ID) error {

	path := "/orgs/" + orgID.String() + "/members/" + userID.String()
	return o.client.RoundTrip(ctx, "DELETE", path, nil, nil, nil)
}
25535
func (s *AuthorizationsService) DeleteImpersonation(ctx context.Context, username string) (*Response, error) {
	u := fmt.Sprintf("admin/users/%v/authorizations", username)
	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}
1053292
func (c *Client) DeleteUser(ctx context.Context, id platform.ID) error {
	err := c.db.Update(func(tx *bolt.Tx) error {
		if pe := c.deleteUsersAuthorizations(ctx, tx, id); pe != nil {
			return pe
		}
		if pe := c.deleteUser(ctx, tx, id); pe != nil {
			return pe
		}
		return nil
	})
	if err != nil {
		return &platform.Error{
			Op:  getOp(platform.OpDeleteUser),
			Err: err,
		}
	}
	return nil
}
770907
func (s *State) MemberRemove(member *Member) error {
	if s == nil {
		return ErrNilState
	}

	guild, err := s.Guild(member.GuildID)
	if err != nil {
		return err
	}

	s.Lock()
	defer s.Unlock()

	members, ok := s.memberMap[member.GuildID]
	if !ok {
		return ErrStateNotFound
	}

	_, ok = members[member.User.ID]
	if !ok {
		return ErrStateNotFound
	}
	delete(members, member.User.ID)

	for i, m := range guild.Members {
		if m.User.ID == member.User.ID {
			guild.Members = append(guild.Members[:i], guild.Members[i+1:]...)
			return nil
		}
	}

	return ErrStateNotFound
}
404404
func (m *Manager) DeleteRegisteringUser(sessionKey string) error {
	return m.collection.Remove(bson.M{"sessionkey": sessionKey})
}
1058204
func mainAdminUserRemove(ctx *cli.Context) error {
	checkAdminUserRemoveSyntax(ctx)

	console.SetColor("UserMessage", color.New(color.FgGreen))

	// Get the alias parameter from cli
	args := ctx.Args()
	aliasedURL := args.Get(0)

	// Create a new MinIO Admin Client
	client, err := newAdminClient(aliasedURL)
	fatalIf(err, "Cannot get a configured admin connection.")

	e := client.RemoveUser(args.Get(1))
	fatalIf(probe.NewError(e).Trace(args...), "Cannot remove new user")

	printMsg(userMessage{
		op:        "remove",
		AccessKey: args.Get(1),
	})

	return nil
}
524815
func (st *State) RemoveUser(tag names.UserTag) error {
	name := strings.ToLower(tag.Name())

	u, err := st.User(tag)
	if err != nil {
		return errors.Trace(err)
	}
	if u.IsDeleted() {
		return nil
	}

	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt > 0 {
			// If it is not our first attempt, refresh the user.
			if err := u.Refresh(); err != nil {
				return nil, errors.Trace(err)
			}
		}
		ops := []txn.Op{{
			Id:     name,
			C:      usersC,
			Assert: txn.DocExists,
			Update: bson.M{"$set": bson.M{"deleted": true}},
		}}
		return ops, nil
	}
	return st.db().Run(buildTxn)
}
801041
func (c *Client) DeleteUser(p *DeleteUserParameter) (*Result, error) {
	obj, err := c.Request("deleteUser", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*Result), err
}
739746
func (s *OrganizationsService) RemoveMember(ctx context.Context, org, user string) (*Response, error) {
	u := fmt.Sprintf("orgs/%v/members/%v", org, user)
	req, err := s.client.NewRequest("DELETE", u, nil)
	if err != nil {
		return nil, err
	}

	return s.client.Do(ctx, req, nil)
}
161296
func (_m *FacadeInterface) RemoveUser(ctx datastore.Context, userName string) error {
	ret := _m.Called(ctx, userName)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, string) error); ok {
		r0 = rf(ctx, userName)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}