diff options
author | Arun Isaac | 2022-09-30 01:50:45 +0530 |
---|---|---|
committer | Arun Isaac | 2022-09-30 01:54:33 +0530 |
commit | 361edf9e2b78144e528343314aa86f5d93e8a494 (patch) | |
tree | 778cfff15428c7db85f7b8f02065496d6faffd6a /wqflask | |
parent | 1a0a83c3491991d4513041443fa12a16f674030c (diff) | |
download | genenetwork2-361edf9e2b78144e528343314aa86f5d93e8a494.tar.gz |
Disregard permissions when displaying search results.
* wqflask/wqflask/gsearch.py: Do not import types.
(is_permitted_for_listing): Delete function.
(GSearch.__init__): Do not call is_permitted_for_listing.
Diffstat (limited to 'wqflask')
-rw-r--r-- | wqflask/wqflask/gsearch.py | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/wqflask/wqflask/gsearch.py b/wqflask/wqflask/gsearch.py index 34368e88..e3049da7 100644 --- a/wqflask/wqflask/gsearch.py +++ b/wqflask/wqflask/gsearch.py @@ -1,5 +1,4 @@ import json -from types import SimpleNamespace from pymonad.maybe import Just, Maybe, Nothing from pymonad.tools import curry @@ -14,23 +13,6 @@ from wqflask.database import xapian_database # number of search results. MAX_SEARCH_RESULTS = 1000 -def is_permitted_for_listing(trait, search_type): - """Check if it is permissible to list trait in search results.""" - dataset_type = {"gene": "ProbeSet", "phenotype": "Publish"} - dataset_ob = (Maybe.apply(curry(2, lambda id, species: - SimpleNamespace(id=id, - type=dataset_type[search_type], - name=trait["dataset"], - species=species))) - .to_arguments(trait["dataset_id"], trait["species"])) - return (Maybe.apply(curry(2, check_resource_availability)) - .to_arguments(dataset_ob, trait["name"]) - .map(lambda permissions: - ((isinstance(permissions["data"], list)) and ("view" in permissions["data"])) - or (permissions["data"] != 'no-access')) - .maybe(False, lambda x: x)) - - class GSearch: def __init__(self, kwargs): if ("type" not in kwargs) or ("terms" not in kwargs): @@ -69,10 +51,8 @@ class GSearch: query, xapian.Query(f"XT{self.type}"))) for i, trait in enumerate( - [trait for xapian_match in enquire.get_mset(0, MAX_SEARCH_RESULTS) - if is_permitted_for_listing( - trait := MonadicDict(json.loads(xapian_match.document.get_data())), - search_type=self.type)]): + [MonadicDict(json.loads(xapian_match.document.get_data())) + for xapian_match in enquire.get_mset(0, MAX_SEARCH_RESULTS)]): trait["index"] = Just(i) trait["location_repr"] = (Maybe.apply(chr_mb) .to_arguments(trait.pop("chr"), trait.pop("mb"))) |