e8ffc5e45bd8e8de9f1c78347ea6b11fd4817a40 chmalee Mon Dec 2 12:37:53 2024 -0800 Generate api keys for each user and store them in hgcentral.hubSpaceKeys diff --git src/hg/hgHubConnect/hgHubConnect.c src/hg/hgHubConnect/hgHubConnect.c index e9fdd0d..2daf923 100644 --- src/hg/hgHubConnect/hgHubConnect.c +++ src/hg/hgHubConnect/hgHubConnect.c @@ -18,33 +18,34 @@ #include "cart.h" #include "dbDb.h" #include "web.h" #include "trackHub.h" #include "hubConnect.h" #include "dystring.h" #include "hPrint.h" #include "jsHelper.h" #include "obscure.h" #include "hgConfig.h" #include "trix.h" #include "net.h" #include "hubSearchText.h" #include "pipeline.h" #include "hubPublic.h" -#include "wikiLink.h" #include "hgHubConnect.h" #include "cartJson.h" +#include "wikiLink.h" +#include "hubSpaceKeys.h" static boolean measureTiming; struct cart *cart; /* The user's ui state. */ struct hash *oldVars = NULL; static char *pageTitle = "Track Data Hubs"; char *database = NULL; char *organism = NULL; struct hubOutputStructure { struct hubOutputStructure *next; struct dyString *metaTags; struct dyString *descriptionMatch; @@ -405,48 +406,78 @@ jsInlineF("%s", line); pipelineClose(&pl); // the 'false' below prevents a few hub-search specific jstree configuration options jsInline("hubSearchTree.init(false);"); } errCatchEnd(errCatch); if (errCatch->gotError || errCatch->gotWarning) { printf("hubCheck timed out after running for %d minute%s. Please try on a Unix command line", hubCheckTimeout / 60, hubCheckTimeout/60 > 1 ? "s" : ""); ret = 1; } errCatchFree(&errCatch); return ret; } +static char *getApiKey(char *userName) +/* Grab the already created api key if it exists */ +{ +struct sqlConnection *conn = hConnectCentral(); +struct dyString *query = sqlDyStringCreate("select apiKey from %s where userName='%s'", HUBSPACE_AUTH_TABLE, userName); +char *apiKey = sqlQuickString(conn, dyStringCannibalize(&query)); +hDisconnectCentral(&conn); +return apiKey; +} + void printApiKeySection() { -puts("