summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2013-05-27 11:10:59 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2013-05-27 11:10:59 +0100
commit886996ef0544e44042a70a8a0f30c044932a0d5f (patch)
treea04059f5e29a4e5b7888f604b25b3c00f75ea4d6
parent57a8d542932fdebbbfa8fbcec81d7dfb8dfd5dd0 (diff)
downloadgitano-886996ef0544e44042a70a8a0f30c044932a0d5f.tar.bz2
ADMINCOMMAND: Fix group del to remove subgroup membership
Before this patch, if you used 'group del' to remove a group which was a subgroup member of another group, the resulting config would not parse. This fixes that.
-rw-r--r--lib/gitano/admincommand.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/gitano/admincommand.lua b/lib/gitano/admincommand.lua
index a89d4e9..0f2e4ee 100644
--- a/lib/gitano/admincommand.lua
+++ b/lib/gitano/admincommand.lua
@@ -476,6 +476,14 @@ local function builtin_group_run(conf, _, cmdline, env)
elseif cmdline[4] ~= token then
log.fatal("Token does not match. Has someone else done administrative actions?")
else
+ for gg, gtab in pairs(conf.groups) do
+ if gtab.subgroups[g] then
+ table.remove(gtab.subgroups, gtab.subgroups[g])
+ gtab.subgroups[g] = nil
+ gtab.changed_tables()
+ log.state("Removed:", g, "from subgroup membership of", gg)
+ end
+ end
conf.groups[g] = nil
reason = "Delete group " .. g
end