mirror of
https://github.com/etlegacy/wolfadmin.git
synced 2024-11-10 06:41:53 +00:00
Correctly merge tables when copying levels from one to another
This commit is contained in:
parent
d5f051890a
commit
2d349919d0
2 changed files with 13 additions and 2 deletions
|
@ -126,7 +126,7 @@ end
|
|||
function acl.copyLevelPermissions(levelId, newLevelId)
|
||||
db.copyLevelPermissions(levelId, newLevelId)
|
||||
|
||||
cachedLevels[newLevelId] = tables.copy(cachedLevels[levelId])
|
||||
cachedLevels[newLevelId] = tables.merge(cachedLevels[newLevelId], cachedLevels[levelId])
|
||||
end
|
||||
|
||||
function acl.removeLevelPermissions(levelId)
|
||||
|
|
|
@ -19,8 +19,19 @@ local util = wolfa_requireModule("util.util")
|
|||
|
||||
local tables = {}
|
||||
|
||||
function tables.merge(tbl1, tbl2)
|
||||
util.typecheck("tables.merge", {tbl1}, {"table"})
|
||||
util.typecheck("tables.merge", {tbl2}, {"table"})
|
||||
|
||||
for key, value in pairs(tbl2) do
|
||||
tbl1[key] = value
|
||||
end
|
||||
|
||||
return tbl1
|
||||
end
|
||||
|
||||
function tables.copy(tbl)
|
||||
util.typecheck("tables.contains", {tbl}, {"table"})
|
||||
util.typecheck("tables.copy", {tbl}, {"table"})
|
||||
|
||||
local copy = {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue