From 95c259b702a0140d2b54a25d34e4183c011aa055 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Mon, 15 Mar 2010 22:40:15 +0100 Subject: [PATCH] Fix an issue with empty perms being serialized to arrays, while non-empty perms are being serialized to hashes. --- kronolith/js/kronolith.js | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index 8ae154138..bf401a251 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2406,27 +2406,31 @@ KronolithCore = { } break; case 'groups': - $H(perm.value).each(function(group) { - this.insertGroupOrUser(type, 'group', group.key); - groupPerms = group.value; - groupId = group.key; - }, this); - if (Object.isUndefined(basic) && - $H(perm.value).size() == 1 && - (groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read) || - groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read | Kronolith.conf.perms.edit))) { - basic = groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read) ? 'group_read' : 'group_edit'; - } else { - advanced = true; + if (perm.value.size()) { + $H(perm.value).each(function(group) { + this.insertGroupOrUser(type, 'group', group.key); + groupPerms = group.value; + groupId = group.key; + }, this); + if (Object.isUndefined(basic) && + $H(perm.value).size() == 1 && + (groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read) || + groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read | Kronolith.conf.perms.edit))) { + basic = groupPerms == (Kronolith.conf.perms.show | Kronolith.conf.perms.read) ? 'group_read' : 'group_edit'; + } else { + advanced = true; + } } break; case 'users': - $H(perm.value).each(function(user) { - if (user.key != Kronolith.conf.user) { - this.insertGroupOrUser(type, 'user', user.key); - advanced = true; - } - }, this); + if (perm.value.size()) { + $H(perm.value).each(function(user) { + if (user.key != Kronolith.conf.user) { + this.insertGroupOrUser(type, 'user', user.key); + advanced = true; + } + }, this); + } break; } -- 2.11.0