2 LuCI - Lua Development Framework
4 Copyright 2009 Steven Barth <steven@midlink.org>
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
15 local require, ipairs, pcall = require, ipairs, pcall
16 local srv = require "luci.lucid.rpc.server"
18 module "luci.lucid.rpc"
21 function factory(publisher)
22 local root = srv.Module()
23 local server = srv.Server(root)
25 for _, r in ipairs(publisher) do
26 for _, m in ipairs(r.export) do
27 local s, mod = pcall(require, r.namespace .. "." .. m)
29 local module = mod._factory()
32 for _, x in ipairs(r.exec) do
33 if x:sub(1,1) == ":" then
34 module:restrict({interface = x:sub(2)})
36 module:restrict({user = x})
48 return function(...) return server:process(...) end