Software /
code /
prosody-modules
Annotate
mod_groups_shell/mod_groups_shell.lua @ 5160:8474a3b80200
mod_firewall: Fix 'is_admin' internal dependency rule #1797 (thanks diane)
Looks like the boolean logic was inverted here. Instead, for now,
simply check if is_admin is there. It is deprecated in trunk and was
briefly removed before being brought back with a 'deprecated' warning as
part of the new roles and permissions work. Making this dependency
conditioned on the existence of the underlying function should make it
work until it actually goes away for real.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 27 Jan 2023 23:06:25 +0100 |
parent | 4431:8b69e0b56db2 |
rev | line source |
---|---|
4431
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
1 module:set_global() |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
2 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
3 local modulemanager = require "core.modulemanager"; |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
4 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
5 local shell_env = module:shared("/*/admin_shell/env") |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
6 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
7 shell_env.groups = {}; |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
8 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
9 function shell_env.groups:sync_group(host, group_id) |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
10 local print = self.session.print; |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
11 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
12 if not host then |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
13 return false, "host not given" |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
14 end |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
15 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
16 local mod_groups = modulemanager.get_module(host, "groups_internal") |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
17 if not mod_groups then |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
18 return false, host .. " does not have mod_groups_internal loaded" |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
19 end |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
20 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
21 if not group_id then |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
22 return false, "group id not given" |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
23 end |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
24 |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
25 local ok, err = mod_groups.emit_member_events(group_id) |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
26 if ok then |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
27 return true, "Synchronised members" |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
28 else |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
29 return ok, err |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
30 end |
8b69e0b56db2
mod_groups_shell: add an admin shell command for updating bookmarks
Jonas Schäfer <jonas@wielicki.name>
parents:
diff
changeset
|
31 end |