summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--acf/model/aaa.lua2
-rw-r--r--acf/model/field.lua2
-rw-r--r--acf/model/init.lua4
-rw-r--r--acf/model/node.lua8
-rw-r--r--acf/model/permission.lua2
-rw-r--r--acf/model/root.lua8
-rw-r--r--acf/transaction/init.lua4
-rw-r--r--server.lua8
8 files changed, 19 insertions, 19 deletions
diff --git a/acf/model/aaa.lua b/acf/model/aaa.lua
index 4685a41..9e67aa2 100644
--- a/acf/model/aaa.lua
+++ b/acf/model/aaa.lua
@@ -25,7 +25,7 @@ function User:check_permission(permission)
if self.superuser then return true end
- assert(getmetatable(self).txn:search('/auth/permissions')[permission])
+ assert(getmetatable(self).txn:fetch('/auth/permissions')[permission])
for _, role in M.node.pairs(self.roles) do
for _, p in M.node.pairs(role.permissions) do
diff --git a/acf/model/field.lua b/acf/model/field.lua
index 98a4397..c69b4d7 100644
--- a/acf/model/field.lua
+++ b/acf/model/field.lua
@@ -193,7 +193,7 @@ function TreeNode:save(context, value)
local path = context.path
if value == path then return end
- if type(value) == 'string' then value = context.txn:search(value) end
+ if type(value) == 'string' then value = context.txn:fetch(value) end
if object.isinstance(value, node.TreeNode) and node.path(value) == path then
return
end
diff --git a/acf/model/init.lua b/acf/model/init.lua
index 1870849..a53cc0d 100644
--- a/acf/model/init.lua
+++ b/acf/model/init.lua
@@ -68,7 +68,7 @@ function Reference:meta(context)
local txn = context.txn
local objs = txn:get(
- node.addr(relabel('system', txn.search, txn, res.scope))
+ node.addr(relabel('system', txn.fetch, txn, res.scope))
) or {}
res.choice = map(function(p) return pth.join(res.scope, p) end, objs)
res['ui-choice'] = objs
@@ -77,7 +77,7 @@ function Reference:meta(context)
end
function Reference:follow(context, value)
- return context.txn:search(pth.rawjoin(self:abs_scope(context), value))
+ return context.txn:fetch(pth.rawjoin(self:abs_scope(context), value))
end
function Reference:load(context)
diff --git a/acf/model/node.lua b/acf/model/node.lua
index f3f9d28..d038e6e 100644
--- a/acf/model/node.lua
+++ b/acf/model/node.lua
@@ -72,7 +72,7 @@ function TreeNode:init(context)
function mt.has_permission(user, permission)
local p = permission..mt.path
- if mt.txn:search('/auth/permissions')[p] then
+ if mt.txn:fetch('/auth/permissions')[p] then
return user:check_permission(p)
end
@@ -85,7 +85,7 @@ function TreeNode:init(context)
mt.txn.validable[mt.path] = mt.addr
end
-function TreeNode:search(path, create)
+function TreeNode:fetch(path, create)
if type(path) == 'string' then path = pth.split(path) end
if #path == 0 then return self end
@@ -106,7 +106,7 @@ function TreeNode:search(path, create)
raise(pth.join(mt.path, name), 'Is a primitive value')
end
- return TreeNode.search(next, path, create)
+ return TreeNode.fetch(next, path, create)
end
@@ -116,7 +116,7 @@ function Collection:init(context, params)
super(self, Collection):init(context)
self.init = nil
- self.search = nil
+ self.fetch = nil
local field = BoundMember(self, params.field)
diff --git a/acf/model/permission.lua b/acf/model/permission.lua
index aac84f7..204f9b1 100644
--- a/acf/model/permission.lua
+++ b/acf/model/permission.lua
@@ -10,7 +10,7 @@ local start = require('acf.transaction').start
function define(path, ...)
local txn = start()
- local db = txn:search('/auth/permissions')
+ local db = txn:fetch('/auth/permissions')
for _, permission in ipairs(arg) do insert(db, permission..path) end
txn:commit()
end
diff --git a/acf/model/root.lua b/acf/model/root.lua
index da15411..d17f8a9 100644
--- a/acf/model/root.lua
+++ b/acf/model/root.lua
@@ -25,9 +25,9 @@ function RootModel:has_permission(user, permission)
end
function RootModel:meta(path)
- local obj = self:search(path, true)
+ local obj = self:fetch(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))
+ return node.mmeta(self:fetch(pth.parent(path), true), pth.name(path))
end
@@ -62,7 +62,7 @@ function register(name, field, params)
local root = RootModel()
- for _, record in ipairs(node.topology(root:search(name))) do
+ for _, record in ipairs(node.topology(root:fetch(name))) do
local top = topology(record.addr, true)
setdefault(top, 'order', order)
@@ -80,7 +80,7 @@ function register(name, field, params)
set(
'scope',
node.addr(
- root:search(
+ root:fetch(
pth.to_absolute(record.scope, pth.parent(record.path))
)
)
diff --git a/acf/transaction/init.lua b/acf/transaction/init.lua
index b18c57a..a76e7bf 100644
--- a/acf/transaction/init.lua
+++ b/acf/transaction/init.lua
@@ -120,7 +120,7 @@ function Transaction:_set_multiple(mods)
end
end
-function Transaction:search(path) return self.root:search(path) end
+function Transaction:fetch(path) return self.root:fetch(path) end
function Transaction:meta(path) return self.root:meta(path) end
@@ -131,7 +131,7 @@ function Transaction:commit()
local errors = ErrorDict()
for path, addr in pairs(copy(self.validable)) do
if self:get(addr) ~= nil then
- errors:collect(getmetatable(self:search(path)).validate)
+ errors:collect(getmetatable(self:fetch(path)).validate)
end
end
errors:raise()
diff --git a/server.lua b/server.lua
index b9c22fd..c3a25a9 100644
--- a/server.lua
+++ b/server.lua
@@ -77,7 +77,7 @@ return function(env)
local txn = acf.transaction.start(parent_txn, true)
local function fetch_user(name)
- user = name and txn:search('/auth/users')[name]
+ user = name and txn:fetch('/auth/users')[name]
end
if user then
fetch_user(user)
@@ -126,12 +126,12 @@ return function(env)
local parent, name, res
if path ~= '/' then
- parent = txn:search(acf.path.parent(path))
+ parent = txn:fetch(acf.path.parent(path))
name = acf.path.name(path)
end
if method == 'GET' then
- local obj = txn:search(path)
+ local obj = txn:fetch(path)
if type(obj) == 'function' then return 404 end
@@ -165,7 +165,7 @@ return function(env)
end
if method == 'POST' then
- local obj = txn:search(path)
+ local obj = txn:fetch(path)
if acf.object.isinstance(obj, mnode.List) then
if not mnode.has_permission(obj, user, 'create') then