--[[
Copyright (c) 2012-2013 Kaarle Ritvanen
See LICENSE file for license details
--]]

local M = {}

local insert = require('acf2.model.node').insert
local start_txn = require('acf2.transaction')

function M.define(path, ...)
   local txn = start_txn()
   local db = txn:fetch('/auth/permissions')
   for _, permission in ipairs{...} do insert(db, permission..path) end
   txn:commit()
end

function M.defaults(path)
   M.define(path, 'read', 'create', 'modify', 'delete')
end

return M
