#NEWLINE# @ routes . route ( org_scoped_rule ( '/public/dashboards/<token>' ) , methods = [ 'GET' ] ) #NEWLINE# @ login_required #NEWLINE# def public_dashboard( token , org_slug = None ) : #NEWLINE# #INDENT# if ( not isinstance ( current_user , models . ApiUser ) ) : #NEWLINE# #INDENT# api_key = models . ApiKey . get_by_api_key ( token ) #NEWLINE# dashboard = api_key . object #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# dashboard = current_user . object #NEWLINE# #UNINDENT# user = { #NEWLINE# #INDENT# 'permissions' : [ ] , #NEWLINE# 'apiKey' : current_user . id , #NEWLINE# #UNINDENT# } #NEWLINE# headers = { #NEWLINE# #INDENT# 'Cache-Control' : 'no-cache, no-store, max-age=0, must-revalidate' , #NEWLINE# #UNINDENT# } #NEWLINE# record_event ( current_org , current_user , { #NEWLINE# #INDENT# 'action' : 'view' , #NEWLINE# 'object_id' : dashboard . id , #NEWLINE# 'object_type' : 'dashboard' , #NEWLINE# 'public' : True , #NEWLINE# 'headless' : ( 'embed' in request . args ) , #NEWLINE# 'referer' : request . headers . get ( 'Referer' ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# response = render_template ( 'public.html' , headless = ( 'embed' in request . args ) , user = json . dumps ( user ) , seed_data = json_dumps ( { #NEWLINE# #INDENT# 'dashboard' : serializers . public_dashboard ( dashboard ) , #NEWLINE# #UNINDENT# } ) , client_config = json . dumps ( settings . COMMON_CLIENT_CONFIG ) ) #NEWLINE# return ( response , 200 , headers )