summaryrefslogtreecommitdiffstats
path: root/acf/model/root.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf/model/root.lua')
-rw-r--r--acf/model/root.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/acf/model/root.lua b/acf/model/root.lua
index a786064..8571527 100644
--- a/acf/model/root.lua
+++ b/acf/model/root.lua
@@ -5,20 +5,28 @@ See LICENSE file for license details
module(..., package.seeall)
+local node = require('acf.model.node')
local model = require('acf.model.model')
-local super = require('acf.object').super
+local object = require('acf.object')
+local pth = require('acf.path')
RootModel = model.new()
function RootModel:init(txn)
- super(self, RootModel):init{txn=txn, path='/', addr='/volatile'}
+ object.super(self, RootModel):init{txn=txn, path='/', addr='/volatile'}
end
function RootModel:has_permission(user, permission)
return permission == 'read'
end
+function RootModel:meta(path)
+ local obj = self:search(path, true)
+ if object.isinstance(obj, node.TreeNode) then return node.meta(obj) end
+ return node.mmeta(self:search(pth.parent(path), true), pth.name(path))
+end
+
function register(name, addr, field)
RootModel[name] = model.to_field(field, addr)
end