code: func (api OrganizationsAPI) GetUserGrants(w http.ResponseWriter, r *http.Request) {
  	globalID := mux.Vars(r)["globalid"]
  	userIdentifier := mux.Vars(r)["username"]
  
  	userObj, err := SearchUser(r, userIdentifier)
  	if err != nil && !db.IsNotFound(err) {
  		log.Error("Failed to look up user identifier: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  	if err != nil {
  		log.Debug("If the user doesn't exist he also can't have an authorization")
  		// No user found for this identifier, return an empty list of grants
  		w.WriteHeader(http.StatusForbidden)
  		return
  	}
  
  	hasAuth, err := hasAuthorization(r, userObj.Username, globalID)
  	if handleServerError(w, "checking if user has an authorization for the organization", err) {
  		return
  	}
  	if !hasAuth {
  		log.Debug("Refusing to list grants for user without authorization")
  		w.WriteHeader(http.StatusForbidden)
  		w.Write([]byte("User does not have an authorization for this organzation"))
  		return
  	}
  
  	grantMgr := grants.NewManager(r)
  	grantObj, err := grantMgr.GetGrantsForUser(userObj.Username, globalID)
  	if err != nil && !db.IsNotFound(err) {
  		log.Error("Failed to look up user grants: ", err)
  		http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
  		return
  	}
  	if db.IsNotFound(err) {
  		grantObj = &grants.SavedGrants{Grants: []grants.Grant{}}
  	}
  
  	w.Header().Set("Content-Type", "application/json")
  	w.WriteHeader(http.StatusOK)
  	json.NewEncoder(w).Encode(grantObj.Grants)
  }
docs: // GetUserGrants lists all grants for a user