code: func (api UsersAPI) LeaveOrganization(w http.ResponseWriter, r *http.Request) {
  	username := mux.Vars(r)["username"]
  	organizationGlobalId := mux.Vars(r)["globalid"]
  	orgMgr := organizationDb.NewManager(r)
  	userMgr := user.NewManager(r)
  	oauthMgr := oauthservice.NewManager(r)
  	// make sure the last owner can't leave an organization. only valid if this is
  	// a top level organization since suborg owners are implicitly extended by the owner
  	// of the parent orgs.
  	if !strings.Contains(organizationGlobalId, ".") {
  		org, err := orgMgr.GetByName(organizationGlobalId)
  		// load the org
  		if db.IsNotFound(err) {
  			writeErrorResponse(w, http.StatusNotFound, "user_not_found")
  			return
  		}
  		if handleServerError(w, "loading organization", err) {
  			return
  		}
  		// if only one owner remains and its the user then don't let them leave
  		if len(org.Owners) == 1 && org.Owners[0] == username {
  			writeErrorResponse(w, http.StatusConflict, "last_owner_can't_leave")
  			return
  		}
  	}
  	err := orgMgr.RemoveUser(organizationGlobalId, username)
  	if err == mgo.ErrNotFound {
  		writeErrorResponse(w, http.StatusNotFound, "user_not_found")
  		return
  	} else if handleServerError(w, "removing user from organization", err) {
  		return
  	}
  	err = userMgr.DeleteAuthorization(username, organizationGlobalId)
  	if handleServerError(w, "removing authorization", err) {
  		return
  	}
  	err = oauthMgr.RemoveOrganizationScopes(organizationGlobalId, username)
  	if handleServerError(w, "removing organization scopes", err) {
  		return
  	}
  	w.WriteHeader(http.StatusNoContent)
  }
docs: // LeaveOrganization is the handler for DELETE /users/{username}/organizations/{globalid}/leave
  // Removes the user from an organization