ec1d9ccbe450f877f80572cdf537f9b7404640a0 max Fri Jul 15 08:02:21 2022 -0700 add tbNoGenome setting for hgTables, refs #29729 diff --git src/hg/cgilib/cartTrackDb.c src/hg/cgilib/cartTrackDb.c index 92f2ac4..36d2a5c 100644 --- src/hg/cgilib/cartTrackDb.c +++ src/hg/cgilib/cartTrackDb.c @@ -35,31 +35,31 @@ struct trackDb *tdb, *nextTdb, *newList = NULL; for (tdb = list; tdb != NULL; tdb = nextTdb) { nextTdb = tdb->next; if (tdbIsDownloadsOnly(tdb) || tdb->table == NULL) { //freeMem(tdb); // should not free tdb's. // While hdb.c should and says it does cache the tdbList, it doesn't. // The most notable reason that the tdbs are not cached is this hgTables CGI !!! // It needs to be rewritten to make tdbRef structures for the lists it creates here! continue; } char *tbOff = trackDbSetting(tdb, "tableBrowser"); if (useAC && tbOff != NULL && - (startsWithWord("off", tbOff) || startsWithWord("noGenome", tbOff))) + (startsWithWord("off", tbOff) || startsWithWord("noGenome", tbOff) || startsWithWord("tbNoGenome", tbOff))) { slAddHead(&accessControlTrackRefList, slRefNew(tdb)); if (! startsWithWord("off", tbOff)) slAddHead(&newList, tdb); } else slAddHead(&newList, tdb); } slReverse(&newList); list = newList; // Add custom tracks at head of list struct customTrack *ctList, *ct; ctList = customTracksParseCart(db, cart, NULL, NULL); for (ct = ctList; ct != NULL; ct = ct->next) @@ -256,33 +256,38 @@ sr = sqlGetResult(conn, query); while ((row = sqlNextRow(sr)) != NULL) acHashAddOneTable(acHash, row[0], chopAtFirstDot(row[1]), FALSE); sqlFreeResult(&sr); } hFreeConn(&conn); } struct slRef *tdbRef; for (tdbRef = accessControlTrackRefList; tdbRef != NULL; tdbRef = tdbRef->next) { struct trackDb *tdb = tdbRef->val; char *tbOff = cloneString(trackDbSetting(tdb, "tableBrowser")); if (isEmpty(tbOff)) errAbort("accessControlInit bug: tdb for %s does not have tableBrowser setting", tdb->track); - // First word is "off" or "noGenome": + // First word is "off" or "noGenome" or "tbNoGenome": char *type = nextWord(&tbOff); + boolean isNoGenome = sameString(type, "noGenome"); + if (!isNoGenome) + isNoGenome = sameString(type, "tbNoGenome"); // like 'noGenome' but only in the table browser, not the API + // since the API does not use this function + // Add track table to acHash: acHashAddOneTable(acHash, tdb->table, NULL, isNoGenome); // Remaining words are additional table names to add: char *tbl; while ((tbl = nextWord(&tbOff)) != NULL) acHashAddOneTable(acHash, tbl, NULL, isNoGenome); } return acHash; } static struct hash *getCachedAcHash(char *db) /* Returns a hash that maps table names to accessControl, creating it if necessary. */ { static struct hash *dbToAcHash = NULL; if (dbToAcHash == NULL)