def view(request): allow_edit = request.unauthenticated_userid is not None session = DBSession() params = dict(request.params) main_search = params.pop('main_search', None) if main_search is not None: groups = [gr.strip() for gr in main_search.split(" ") if len(gr.strip()) > 0] for gr in groups: if ":" in gr: k, v = gr.split(":") params[k.strip()] = v.strip() else: params["name"] = gr res = search(session, params) ros = [] for ro in res: role = ro.access_role(session, request.unauthenticated_userid) if role != Role.denied: ros.append((Role.to_str(role), ro)) query = " ".join("%s:%s" % kv for kv in params.items()) return {'allow_edit': allow_edit, 'query': query, 'ros': ros}
def view(request): session = DBSession() user = request.unauthenticated_userid if 'uid' in request.params: # search a RO with a specific id uid = request.params['uid'] ro = ResearchObject.get(session, uid) if ro is None: return None else: # check credentials role = ro.access_role(session, user) if role == Role.denied: return None else: return ro.repr_json(full=True) else: ros = search(session, request.params) return [ro.id for ro in ros if ro.access_role(session, user) != Role.denied]