summaryrefslogtreecommitdiffstats
path: root/openvpn-controller.lua
diff options
context:
space:
mode:
Diffstat (limited to 'openvpn-controller.lua')
-rw-r--r--openvpn-controller.lua54
1 files changed, 27 insertions, 27 deletions
diff --git a/openvpn-controller.lua b/openvpn-controller.lua
index 85deb28..a2926d6 100644
--- a/openvpn-controller.lua
+++ b/openvpn-controller.lua
@@ -4,46 +4,46 @@ require("controllerfunctions")
default_action = "status"
-status = function (self)
+status = function(self)
return self.model.getstatus()
end
-listconfigs = function (self)
- return self.model.get_conflist()
+startstop = function(self)
+ return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata)
end
-editconfig = function (self)
- return controllerfunctions.handle_form(self, function() return self.model.get_filecontent(self.clientdata.name) end, self.model.update_filecontent, self.clientdata, "Save", "Edit Config File", "Config File Saved")
+expert = function(self)
+ return controllerfunctions.handle_form(self, self.model.get_filecontent, self.model.update_filecontent, self.clientdata, "Save", "Edit Config File", "Config File Saved")
end
-createconfig = function ( self )
- return controllerfunctions.handle_form(self, self.model.create_new_config, self.model.create_config, self.clientdata, "Create", "Create new config", "New config Created")
+viewconfig = function(self)
+ return self.model.get_config()
end
-deleteconfig = function(self)
- return self:redirect_to_referrer(self.model.delete_config(self.clientdata.name))
+statusinfo = function (self)
+ return self.model.getclientinfo()
end
-viewconfig = function(self)
- return self.model.get_config(self.clientdata.name)
+logfile = function (self)
+ return self.model.get_logfile()
end
-statusinfo = function (self)
- return self.model.getclientinfo(self.clientdata.name)
+function listcerts(self)
+ return self.model.list_certs()
end
-logfile = function (self)
- return self.model.get_logfile(self.clientdata.name)
-end
-
-function startstop(self)
- local data = self.model.startstop_service(clientdata.action,clientdata.service)
- data.service = clientdata.service
- if (data) and (data.value) and (data.value.result) and (data.value.result.value) then
- redirect(self, "listconfigs")
- end
- if not (clientdata.service) then
- redirect(self, "listconfigs")
- end
- return data
+function deletecert(self)
+ return self:redirect_to_referrer(self.model.delete_cert(self.clientdata.cert))
+end
+
+function uploadcert (self)
+ return controllerfunctions.handle_form(self, self.model.new_upload_cert, self.model.upload_cert, self.clientdata, "Upload", "Upload Certificate", "Certificate Uploaded")
+end
+
+function viewcert(self)
+ return self.model.view_cert(self.clientdata.cert)
+end
+
+function generatedhparams(self)
+ return self:redirect_to_referrer(self.model.generate_dh_params())
end