summaryrefslogtreecommitdiffstats
path: root/syslog-controller.lua
blob: be3e32215e7725f5aa2372c60484a78b0f5a0226 (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

module(..., package.seeall)

require("privsep")
require("join")

-- those should go into acf.conf
local user="nobody"
local group="nobody"

-- drop privileges and put privileged model funcs in self.priv
mvc = {}
function mvc.on_load(self)
	self.priv = privsep.drop_privs(user, group, self.model.priv)
end

function basic(self)
	local ctl = {}
	local opts = self.model.readopts()
	ctl.pidlist = self.priv.is_enabled() 
	if pidlist then
		ctl.enabled = "checked=yes"
		ctl.disabled = ""
	else
		ctl.enabled = ""
		ctl.disabled = "checked=yes"
	end
	ctl.opts = opts
	if opts and opts.remote then
		ctl.remote = "checked"
		ctl.host = opts.remote
	else
		ctl.remote = ""
		ctl.host = ""
	end
	ctl.debug="opts="..tostring(opts)

	return ctl
end