Fixed acl not being able to copy level permissions to levels with existing permissions

This commit is contained in:
Timo Smit 2019-01-29 22:49:20 +01:00
parent e9a4704df1
commit 4d332c36a0
3 changed files with 2 additions and 8 deletions

View file

@ -161,12 +161,6 @@ function commandAclCopyLevelPermissions(levelId, newLevelId)
return true
end
if #acl.getLevelPermissions(newLevelId) ~= 0 then
et.G_Print("error: level "..newLevelId.." already has permissions\n")
return true
end
acl.copyLevelPermissions(levelId, newLevelId)
et.G_Print("copied permissions from "..levelId.." to "..newLevelId.."\n")

View file

@ -178,7 +178,7 @@ function mysql.removeLevelPermission(levelId, permission)
end
function mysql.copyLevelPermissions(levelId, newLevelId)
cur = assert(con:execute("INSERT INTO `level_permission` (`level_id`, `permission`) SELECT '"..tonumber(newLevelId).."' AS `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(levelId)))
cur = assert(con:execute("INSERT INTO `level_permission` (`level_id`, `permission`) SELECT "..tonumber(newLevelId).." AS `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(levelId).." EXCEPT SELECT `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(newLevelId)))
end
function mysql.removeLevelPermissions(levelId)

View file

@ -178,7 +178,7 @@ function sqlite3.removeLevelPermission(levelId, permission)
end
function sqlite3.copyLevelPermissions(levelId, newLevelId)
cur = assert(con:execute("INSERT INTO `level_permission` (`level_id`, `permission`) SELECT '"..tonumber(newLevelId).."' AS `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(levelId)))
cur = assert(con:execute("INSERT INTO `level_permission` (`level_id`, `permission`) SELECT "..tonumber(newLevelId).." AS `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(levelId).." EXCEPT SELECT `level_id`, `permission` FROM `level_permission` WHERE `level_id`="..tonumber(newLevelId)))
end
function sqlite3.removeLevelPermissions(levelId)