diff --git a/luascripts/wolfadmin/commands/server/acl.lua b/luascripts/wolfadmin/commands/server/acl.lua index e01ff50..afa356e 100644 --- a/luascripts/wolfadmin/commands/server/acl.lua +++ b/luascripts/wolfadmin/commands/server/acl.lua @@ -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") diff --git a/luascripts/wolfadmin/db/mysql.lua b/luascripts/wolfadmin/db/mysql.lua index 97c123c..f117f75 100644 --- a/luascripts/wolfadmin/db/mysql.lua +++ b/luascripts/wolfadmin/db/mysql.lua @@ -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) diff --git a/luascripts/wolfadmin/db/sqlite3.lua b/luascripts/wolfadmin/db/sqlite3.lua index 61db4f0..2aa9715 100644 --- a/luascripts/wolfadmin/db/sqlite3.lua +++ b/luascripts/wolfadmin/db/sqlite3.lua @@ -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)