Mercurial > prosody-hg
comparison plugins/mod_authz_config.lua @ 10635:675d9fbcbaed
mod_authz_internal, usermanager: Rename to mod_authz_config
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 27 Jan 2020 22:28:52 +0000 |
| parents | plugins/mod_authz_internal.lua@d1cc6af0fb97 |
| children |
comparison
equal
deleted
inserted
replaced
| 10634:c9e1cb7a38b8 | 10635:675d9fbcbaed |
|---|---|
| 1 local normalize = require "util.jid".prep; | |
| 2 local admin_jids = module:get_option_inherited_set("admins", {}) / normalize; | |
| 3 local host = module.host; | |
| 4 | |
| 5 local admin_role = { ["prosody:admin"] = true }; | |
| 6 | |
| 7 function get_user_roles(user) | |
| 8 return get_jid_roles(user.."@"..host); | |
| 9 end | |
| 10 | |
| 11 function get_jid_roles(jid) | |
| 12 if admin_jids:contains(jid) then | |
| 13 return admin_role; | |
| 14 end | |
| 15 return nil; | |
| 16 end |
