Mercurial > prosody-hg
comparison core/usermanager.lua @ 13782:4cfabfbb0691 13.0
core.usermanager: Fix COMPAT layer for legacy is_admin() function
Thanks ctrlaltca
Fixes #1912
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Sat, 22 Mar 2025 11:53:15 +0100 |
| parents | b5b0190ddc38 |
| children | 01f95f3de6fc |
comparison
equal
deleted
inserted
replaced
| 13781:97bbe60336bc | 13782:4cfabfbb0691 |
|---|---|
| 305 log("error", "Attempt to use deprecated is_admin() API: %s", debug.traceback()); | 305 log("error", "Attempt to use deprecated is_admin() API: %s", debug.traceback()); |
| 306 return false; | 306 return false; |
| 307 end | 307 end |
| 308 log("warn", "Usage of legacy is_admin() API, which will be disabled in a future build: %s", debug.traceback()); | 308 log("warn", "Usage of legacy is_admin() API, which will be disabled in a future build: %s", debug.traceback()); |
| 309 log("warn", "See https://prosody.im/doc/developers/permissions about the new permissions API"); | 309 log("warn", "See https://prosody.im/doc/developers/permissions about the new permissions API"); |
| 310 return legacy_admin_roles[get_jid_role(jid, host)] or false; | 310 local role = get_jid_role(jid, host); |
| 311 return role and legacy_admin_roles[role.name] or false; | |
| 311 end | 312 end |
| 312 | 313 |
| 313 local function get_users_with_role(role, host) | 314 local function get_users_with_role(role, host) |
| 314 if not hosts[host] then return false; end | 315 if not hosts[host] then return false; end |
| 315 if type(role) ~= "string" then return false; end | 316 if type(role) ~= "string" then return false; end |
