d8a0894d79f6d5b97797d07e0ced60ee37f528c6
angie
  Thu Jun 9 11:36:13 2016 -0700
Revert "duh, if loginSystem is not enabled, we cannot use the gbMembers table.  refs #17327"

This reverts commit 46b4e2937954d44c12dcb496a140608316959d21.

diff --git src/hg/lib/wikiLink.c src/hg/lib/wikiLink.c
index d136db0..c46e5ad 100644
--- src/hg/lib/wikiLink.c
+++ src/hg/lib/wikiLink.c
@@ -257,30 +257,40 @@
 {
 if (wikiLinkEnabled())
     {
     char *wikiUserName = findCookieData(wikiLinkUserNameCookie());
     char *wikiLoggedIn = findCookieData(wikiLinkLoggedInCookie());
 
     if (isNotEmpty(wikiLoggedIn) && isNotEmpty(wikiUserName))
 	{
         if (loginSystemEnabled())
             {
             if (! alreadyAuthenticated)
                 errAbort("wikiLinkUserName: loginSystemValidateCookies must be called first.");
             if (authToken == 0)
                 return NULL;
             }
+        else
+            {
+            // Wiki only: fall back on checking ID cookie vs. gbMembers.idx
+            uint cookieId = getCookieToken();
+            struct sqlConnection *conn = hConnectCentral();
+            uint memberIdx = getMemberIdx(conn, wikiUserName);
+            hDisconnectCentral(&conn);
+            if (cookieId != memberIdx)
+                return NULL;
+            }
 	return cloneString(wikiUserName);
 	}
     }
 else
     errAbort("wikiLinkUserName called when wiki is not enabled (specified "
         "in hg.conf).");
 return NULL;
 }
 
 static char *encodedHgSessionReturnUrl(char *hgsid)
 /* Return a CGI-encoded hgSession URL with hgsid.  Free when done. */
 {
 char retBuf[1024];
 char *cgiDir = cgiScriptDirUrl();
 safef(retBuf, sizeof(retBuf), "http%s://%s%shgSession?hgsid=%s",