# HG changeset patch # User Jonas Schäfer # Date 1612536355 -3600 # Node ID 8b69e0b56db2be28359952803b801fcee5ab6c09 # Parent 71c495fa03f3e79ebd03add934627cb11ca5cd50 mod_groups_shell: add an admin shell command for updating bookmarks diff -r 71c495fa03f3 -r 8b69e0b56db2 mod_groups_shell/mod_groups_shell.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mod_groups_shell/mod_groups_shell.lua Fri Feb 05 15:45:55 2021 +0100 @@ -0,0 +1,31 @@ +module:set_global() + +local modulemanager = require "core.modulemanager"; + +local shell_env = module:shared("/*/admin_shell/env") + +shell_env.groups = {}; + +function shell_env.groups:sync_group(host, group_id) + local print = self.session.print; + + if not host then + return false, "host not given" + end + + local mod_groups = modulemanager.get_module(host, "groups_internal") + if not mod_groups then + return false, host .. " does not have mod_groups_internal loaded" + end + + if not group_id then + return false, "group id not given" + end + + local ok, err = mod_groups.emit_member_events(group_id) + if ok then + return true, "Synchronised members" + else + return ok, err + end +end