26501d3ac1d4eea1d3c539dbbd13e15e46737759
hiram
Tue Sep 24 11:57:57 2019 -0700
correctly recognize the "tableBrowser off" entry in trackDb for protected tables refs #24208
diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c
index af150b5..a81b771 100644
--- src/hg/hubApi/hubApi.c
+++ src/hg/hubApi/hubApi.c
@@ -236,31 +236,31 @@
safef(errorPrint, sizeof(errorPrint), " ERROR: %s", errorString);
}
boolean superChild = tdbIsSuperTrackChild(tdb);
char *genome = NULL;
if (hub)
genome = hub->genomeList->name;
struct dyString *extraDyFlags = newDyString(128);
if (debug)
dyStringAppend(extraDyFlags, ";debug=1");
if (jsonOutputArrays)
dyStringAppend(extraDyFlags, ";jsonOutputArrays=1");
char *extraFlags = dyStringCannibalize(&extraDyFlags);
-if (trackDbSetting(tdb, "tableBrowser"))
+if (protectedTrack(tdb))
hPrintf("
%s : %s <protected data>\n", tdb->track, tdb->type);
else if (db)
{
if (hub)
{
char urlReference[2048];
safef(urlReference, sizeof(urlReference), " (sample data)%s\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint);
if (tdb->parent)
hPrintf("%s: %s subtrack of parent: %s%s\n", tdb->track, tdb->type, tdb->parent->track, urlReference);
else
hPrintf("%s: %s%s\n", tdb->track, tdb->type, urlReference);
}
else
{
@@ -307,31 +307,31 @@
safef(errorPrint, sizeof(errorPrint), " : ERROR: %s", errorString);
}
char countsMessage[512];
countsMessage[0] = 0;
if (chromCount > 0 || itemCount > 0)
{
if (allowedBigBedType(tdb->type))
safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld item count ", chromCount, itemCount);
else if (startsWithWord("bigWig", tdb->type))
safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld bases covered ", chromCount, itemCount);
else
safef(countsMessage, sizeof(countsMessage), " : %ld chroms : %ld count ", chromCount, itemCount);
}
-if (trackDbSetting(tdb, "tableBrowser"))
+if (protectedTrack(tdb))
hPrintf(" %s: %s protected data\n", tdb->track, tdb->type);
else if (isSupportedType(tdb->type))
{
char urlReference[2048];
safef(urlReference, sizeof(urlReference), "(sample data)%s\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint);
if (allowedBigBedType(tdb->type))
hPrintf(" %s: %s%s%s\n", tdb->track, tdb->type, countsMessage, urlReference);
else if (startsWithWord("bigWig", tdb->type))
hPrintf(" %s: %s%s%s\n", tdb->track, tdb->type, countsMessage, urlReference);
else
hPrintf(" %s: %s%s%s\n", tdb->track, tdb->type, countsMessage, urlReference);
}
else
{
@@ -539,40 +539,39 @@
else
hPrintf("%s: %s : subtrack of parent: %s\n", tdbEl->track, tdbEl->type, tdbEl->parent->track);
}
hashCountTrack(tdbEl, countTracks);
if (tdbEl->subtracks)
showSubTracks(hub, db, tdbEl, countTracks, chromName, chromSize, errorString);
}
}
hPrintf(" \n");
}
static void trackSettings(struct trackDb *tdb, struct hash *countTracks)
/* process the settingsHash for a trackDb, recursive when subtracks */
{
hPrintf(" \n");
-boolean protectedData = FALSE;
-if (trackDbSetting(tdb, "tableBrowser"))
- protectedData = TRUE;
+boolean protectedData = protectedTrack(tdb);
struct hashEl *hel;
struct hashCookie hc = hashFirst(tdb->settingsHash);
while ((hel = hashNext(&hc)) != NULL)
{
if (sameWord("track", hel->name))
continue; // already output in header
- if (sameWord("tableBrowser", hel->name))
+ if (sameWord("tableBrowser", hel->name)
+ && startsWithWord("off", (char*)hel->val))
hPrintf(" - protectedData: 'true'
\n");
else if (protectedData && sameWord("bigDataUrl", hel->name))
hPrintf(" - bigDataUrl: <protected data>
\n");
else if (isEmpty((char *)hel->val))
hPrintf(" - %s: <empty>
\n", hel->name);
else
hPrintf(" - %s: '%s'
\n", hel->name, (char *)hel->val);
}
if (tdb->subtracks)
{
struct trackDb *tdbEl = NULL;
if (debug)
hPrintf(" - has %d subtrack(s)
\n", slCount(tdb->subtracks));
for (tdbEl = tdb->subtracks; tdbEl; tdbEl = tdbEl->next)
{
@@ -665,33 +664,31 @@
* char *bigDataIndex, struct hash *countTracks,
* char *chromName, unsigned chromSize)
*/
static void countOneTdb(char *db, struct trackDb *tdb,
struct hash *countTracks, char *chromName, unsigned chromSize,
char *errorString)
/* for this tdb in this db, count it up and provide a sample */
{
char *bigDataUrl = trackDbSetting(tdb, "bigDataUrl");
boolean compositeContainer = tdbIsComposite(tdb);
boolean compositeView = tdbIsCompositeView(tdb);
boolean superChild = tdbIsSuperTrackChild(tdb);
boolean depthSearch = cartUsualBoolean(cart, "depthSearch", FALSE);
-boolean protectedData = FALSE;
-if (trackDbSetting(tdb, "tableBrowser"))
- protectedData = TRUE;
+boolean protectedData = protectedTrack(tdb);
hashCountTrack(tdb, countTracks);
if (compositeContainer)
hPrintf(" - %s: %s : composite track container has %d subtracks
\n", tdb->track, tdb->type, slCount(tdb->subtracks));
else if (compositeView)
hPrintf(" - %s: %s : composite view of parent: %s
\n", tdb->track, tdb->type, tdb->parent->track);
else if (superChild)
{
if (isSupportedType(tdb->type))
sampleUrl(NULL, db, tdb, errorString);
else
hPrintf(" - %s: %s : superTrack child of parent: %s
\n", tdb->track, tdb->type, tdb->parent->track);
}
else if (! depthSearch && bigDataUrl)
{