def standalone_shiny_in_wrapper(request, path=None, sub=None): # Enforce user access restrictions # p1 = fitem.type.shiny_report.report_link_rel_path(fitem.id) path = path or '' sub = sub or '' return aux.proxy_to(request, path + '/' + sub, settings.SHINY_LOCAL_STANDALONE_BREEZE_URL)
def report_shiny_in_wrapper(request, rid, path=None): if not rid or rid == '': return aux.fail_with404(request) try: fitem = Report.objects.get(id=rid) except ObjectDoesNotExist: return aux.fail_with404(request) # Enforce user access restrictions if not fitem.has_access_to_shiny(request.user): raise PermissionDenied p1 = fitem.type.shiny_report.report_link_rel_path(fitem.id) return aux.proxy_to(request, '%s/%s' % (p1, path), settings.SHINY_TARGET_URL)
def check_shiny(request): """ Check if Shiny server is responding :type request: :rtype: bool """ from breeze.auxiliary import proxy_to try: r = proxy_to(request, '', settings.SHINY_LOCAL_LIBS_TARGET_URL, silent=True, timeout=2) if r.status_code == 200: return True except Exception: pass return False
def check_cas(request): """ Check if CAS server is responding :type request: :rtype: bool """ from breeze.auxiliary import proxy_to if utils.is_host_online(settings.CAS_SERVER_IP, 2): try: r = proxy_to(request, '', settings.CAS_SERVER_URL, silent=True, timeout=3) if r.status_code == 200: return True except Exception: pass return False
def proxy_to(request, path, target_url, query_s=''): return aux.proxy_to(request, path, target_url, query_s)
def shiny_libs(request, path=None): return aux.proxy_to(request, '%s' % path, settings.SHINY_LIBS_TARGET_URL)