code: func (api UsersusernameorganizationsAPI) Get(w http.ResponseWriter, r *http.Request) {
  	username := mux.Vars(r)["username"]
  
  	orgMgr := organizationdb.NewManager(r)
  
  	orgs, err := orgMgr.AllByUserChain(username)
  	if err != nil {
  		log.Error("Failed to load all organizations the user belongs to: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  
  	type UserOrganizations struct {
  		Member []string `json:"member"`
  		Owner  []string `json:"owner"`
  	}
  	userOrgs := UserOrganizations{
  		Member: []string{},
  		Owner:  []string{},
  	}
  
  	availableScopes, _ := context.Get(r, "availablescopes").(string)
  	scopes := oauth2.SplitScopeString(availableScopes)
  	isAdmin := oauth2.CheckScopes([]string{"user:admin"}, scopes)
  
  	// if not isAdmin filter out orgs our scopes have access to
  	if !isAdmin {
  		userOrgs.Member = filterOrgs(orgs, scopes)
  	} else {
  		userOrgs.Member = orgs
  	}
  
  	userOrgs.Owner, userOrgs.Member, err = orgMgr.SplitOwnedOrgs(userOrgs.Member, username)
  	if err != nil {
  		log.Error("Failed to sort organizations to owner and member: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  	}
  	w.Header().Set("Content-type", "application/json")
  	json.NewEncoder(w).Encode(&userOrgs)
  }
docs: // Get the list organizations a user is owner or member of
  // It is handler for GET /users/{username}/organizations