Start to create method to download script
diff --git a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
index 80eaae1..c50bd47 100644
--- a/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
+++ b/views/ngXosViews/vpnDashboard/src/templates/vpn-list.tpl.html
@@ -12,6 +12,6 @@
<div class="cell">{{vpn.server_network}}</div>
<div class="cell">{{vpn.vpn_subnet}}</div>
<div class="cell">
- <a href="/static/vpn/{{ vpn.script }}" target="_blank">Script</a>
+ <a href="/static/vpn/{{ vpn.script }}?pk={{ vpn.pk }}" target="_blank">Script</a>
</div>
</div>
diff --git a/xos/core/xoslib/methods/vpnview.py b/xos/core/xoslib/methods/vpnview.py
index fe2f323..fcbe577 100644
--- a/xos/core/xoslib/methods/vpnview.py
+++ b/xos/core/xoslib/methods/vpnview.py
@@ -1,3 +1,4 @@
+from django.core.exceptions import PermissionDenied
from rest_framework.response import Response
from rest_framework.views import APIView
from services.vpn.models import VPNTenant
@@ -7,4 +8,15 @@
method_name = "vpntenants"
def get(self, request, format=None):
+ if (not request.user.is_authenticated()):
+ raise PermissionDenied("You must be authenticated in order to use this API")
+ return Response(VPNTenant.get_tenant_objects())
+
+class ClientScript(APIView):
+ method_kind = "detail"
+ method_name = "clientscript"
+
+ def get(self, request, format=None):
+ if (not request.user.is_authenticated()):
+ raise PermissionDenied("You must be authenticated in order to use this API")
return Response(VPNTenant.get_tenant_objects())