627b526f8ff26ebb7539a5a6ee25f515a88242da
chmalee
  Tue Aug 6 15:10:06 2024 -0700
Can create a directory and place a hub.txt in it, and get an email for a userName

diff --git src/hg/lib/userdata.c src/hg/lib/userdata.c
index 8f23157..7b75f1b 100644
--- src/hg/lib/userdata.c
+++ src/hg/lib/userdata.c
@@ -8,34 +8,46 @@
 #include "hash.h"
 #include "portable.h"
 #include "trashDir.h"
 #include "md5.h"
 #include "hgConfig.h"
 #include "dystring.h"
 #include "cheapcgi.h"
 #include "customFactory.h"
 #include "wikiLink.h"
 #include "userdata.h"
 #include "jksql.h"
 #include "hdb.h"
 #include "hubSpace.h"
 
 char *getUserName()
+/* Query the right system for the users name */
 {
 return (loginSystemEnabled() || wikiLinkEnabled()) ? wikiLinkUserName() : NULL;
 }
 
+char *emailForUserName(char *userName)
+/* Fetch the email for this user from gbMembers hgcentral table */
+{
+struct sqlConnection *sc = hConnectCentral();
+struct dyString *query = sqlDyStringCreate("select email from gbMembers where userName = '%s'", userName);
+char *email = sqlQuickString(sc, dyStringCannibalize(&query));
+hDisconnectCentral(&sc);
+// this should be freeMem'd:
+return email;
+}
+
 char *getDataDir(char *userName)
 /* Return the full path to the user specific data directory, can be configured via hg.conf
  * on hgwdev, this is /data/apache/userdata/userStore/hash/userName/
  * on the RR, this is /userdata/userStore/hash/userName/ */
 {
 char *userDataBaseDir = cfgOption("userDataDir");
 if (!userDataBaseDir  || isEmpty(userDataBaseDir))
     errAbort("trying to save user file but no userDataDir defined in hg.conf");
 if (userDataBaseDir[0] != '/')
     errAbort("config setting userDataDir must be an absolute path (starting with '/')");
 
 char *encUserName = cgiEncode(userName);
 char *userPrefix = md5HexForString(encUserName);
 userPrefix[2] = '\0';