summaryrefslogtreecommitdiffstats
path: root/acf/model/permission.lua
diff options
context:
space:
mode:
Diffstat (limited to 'acf/model/permission.lua')
-rw-r--r--acf/model/permission.lua18
1 files changed, 18 insertions, 0 deletions
diff --git a/acf/model/permission.lua b/acf/model/permission.lua
new file mode 100644
index 0000000..9a6d1d4
--- /dev/null
+++ b/acf/model/permission.lua
@@ -0,0 +1,18 @@
+--[[
+Copyright (c) 2012-2013 Kaarle Ritvanen
+See LICENSE file for license details
+--]]
+
+module(..., package.seeall)
+
+local add = require('acf.model.set').add
+local start = require('acf.transaction').start
+
+function define(path, ...)
+ local txn = start()
+ local db = txn:search('/auth/permissions')
+ for _, permission in ipairs(arg) do add(db, permission..path) end
+ txn:commit()
+end
+
+function defaults(path) define(path, 'read', 'create', 'modify', 'update') end