summaryrefslogtreecommitdiffstats
path: root/samba-controller.lua
blob: e3f1a4fccb169fe55ca880380e2a45ac4f45a2d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
module(..., package.seeall)

-- Load libraries
require("controllerfunctions")

default_action = "status"

function status(self)
	return self.model.getstatus()
end

function startstop(self)
	return controllerfunctions.handle_startstop(self, self.model.startstop_service, self.clientdata)
end

function listfiles(self)
        return self.model.listconfigfiles()
end

function expert(self)
	return controllerfunctions.handle_form(self, function() return self.model.getconfigfile(self.clientdata.filename) end, self.model.setconfigfile, self.clientdata, "Save", "Edit Samba File", "File Saved")
end

function join(self)
	return controllerfunctions.handle_form(self, self.model.get_join, self.model.set_join, self.clientdata, "Join", "Join Domain")
end

function listshares(self)
	return self.model.list_shares()
end

function editshare(self)
	return controllerfunctions.handle_form(self, function() return self.model.read_share(self.clientdata.name) end, self.model.update_share, self.clientdata, "Save", "Edit Share", "Share Saved")
end

function deleteshare(self)
	return self:redirect_to_referrer(self.model.delete_share(self.clientdata.name))
end

function createshare(self)
	return controllerfunctions.handle_form(self, self.model.read_share, self.model.create_share, self.clientdata, "Create", "Create Share", "Share Created")
end