74f1ce41ab30aa506ea6c1bd879e6d42ac596d55 hiram Wed Sep 25 12:24:12 2019 -0700 hard code a list of tables to check for protected data refs #24208 diff --git src/hg/hubApi/hubApi.c src/hg/hubApi/hubApi.c index a81b771..e6ea63e 100644 --- src/hg/hubApi/hubApi.c +++ src/hg/hubApi/hubApi.c @@ -236,31 +236,31 @@ safef(errorPrint, sizeof(errorPrint), " <font color='red'>ERROR: %s</font>", 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 (protectedTrack(tdb)) +if (protectedTrack(tdb, tdb->track)) hPrintf("<li>%s : %s <protected data></li>\n", tdb->track, tdb->type); else if (db) { if (hub) { char urlReference[2048]; safef(urlReference, sizeof(urlReference), " <a href='%s/getData/track?hubUrl=%s;genome=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint); if (tdb->parent) hPrintf("<li><b>%s</b>: %s subtrack of parent: %s%s</li>\n", tdb->track, tdb->type, tdb->parent->track, urlReference); else hPrintf("<li><b>%s</b>: %s%s</li>\n", tdb->track, tdb->type, urlReference); } else { @@ -307,31 +307,31 @@ safef(errorPrint, sizeof(errorPrint), " : <font color='red'>ERROR: %s</font>", 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 (protectedTrack(tdb)) +if (protectedTrack(tdb, tdb->track)) hPrintf(" <li><b>%s</b>: %s protected data</li>\n", tdb->track, tdb->type); else if (isSupportedType(tdb->type)) { char urlReference[2048]; safef(urlReference, sizeof(urlReference), "<a href='%s/getData/track?hubUrl=%s;genome=%s;track=%s;maxItemsOutput=5%s' target=_blank>(sample data)%s</a>\n", urlPrefix, hub->url, genome, tdb->track, extraFlags, errorPrint); if (allowedBigBedType(tdb->type)) hPrintf(" <li><b>%s</b>: %s%s%s</li>\n", tdb->track, tdb->type, countsMessage, urlReference); else if (startsWithWord("bigWig", tdb->type)) hPrintf(" <li><b>%s</b>: %s%s%s</li>\n", tdb->track, tdb->type, countsMessage, urlReference); else hPrintf(" <li><b>%s</b>: %s%s%s</li>\n", tdb->track, tdb->type, countsMessage, urlReference); } else { @@ -539,31 +539,31 @@ else hPrintf("<li><b>%s</b>: %s : subtrack of parent: %s</li>\n", tdbEl->track, tdbEl->type, tdbEl->parent->track); } hashCountTrack(tdbEl, countTracks); if (tdbEl->subtracks) showSubTracks(hub, db, tdbEl, countTracks, chromName, chromSize, errorString); } } hPrintf(" </ul></li>\n"); } static void trackSettings(struct trackDb *tdb, struct hash *countTracks) /* process the settingsHash for a trackDb, recursive when subtracks */ { hPrintf(" <li><ul>\n"); -boolean protectedData = protectedTrack(tdb); +boolean protectedData = protectedTrack(tdb, tdb->track); 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) && startsWithWord("off", (char*)hel->val)) hPrintf(" <li><b>protectedData</b>: 'true'</li>\n"); else if (protectedData && sameWord("bigDataUrl", hel->name)) hPrintf(" <li><b>bigDataUrl</b>: <protected data></li>\n"); else if (isEmpty((char *)hel->val)) hPrintf(" <li><b>%s</b>: <empty></li>\n", hel->name); else hPrintf(" <li><b>%s</b>: '%s'</li>\n", hel->name, (char *)hel->val); @@ -664,31 +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 = protectedTrack(tdb); +boolean protectedData = protectedTrack(tdb, tdb->track); hashCountTrack(tdb, countTracks); if (compositeContainer) hPrintf(" <li><b>%s</b>: %s : composite track container has %d subtracks</li>\n", tdb->track, tdb->type, slCount(tdb->subtracks)); else if (compositeView) hPrintf(" <li><b>%s</b>: %s : composite view of parent: %s</li>\n", tdb->track, tdb->type, tdb->parent->track); else if (superChild) { if (isSupportedType(tdb->type)) sampleUrl(NULL, db, tdb, errorString); else hPrintf(" <li><b>%s</b>: %s : superTrack child of parent: %s</li>\n", tdb->track, tdb->type, tdb->parent->track); } else if (! depthSearch && bigDataUrl) {