mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 03:12:29 +00:00
feat(prosody): New impl of is_admin.
This commit is contained in:
@@ -8,6 +8,9 @@ local array = require "util.array";
|
||||
local is_set = require 'util.set'.is_set;
|
||||
local usermanager = require 'core.usermanager';
|
||||
|
||||
local config_global_admin_jids = module:context('*'):get_option_set('admins', {}) / jid.prep;
|
||||
local config_admin_jids = module:get_option_inherited_set('admins', {}) / jid.prep;
|
||||
|
||||
local http_timeout = 30;
|
||||
local have_async, async = pcall(require, "util.async");
|
||||
local http_headers = {
|
||||
@@ -628,8 +631,15 @@ function get_ip(session)
|
||||
end
|
||||
|
||||
-- Checks whether the provided jid is in the list of admins
|
||||
local function is_admin(jid)
|
||||
return usermanager.is_admin(jid, module.host);
|
||||
-- we are not using the new permissions and roles api as we have few global modules which need to be
|
||||
-- refactored into host modules, as that api needs to be executed in host context
|
||||
local function is_admin(_jid)
|
||||
local bare_jid = jid.bare(_jid);
|
||||
|
||||
if config_global_admin_jids:contains(bare_jid) or config_admin_jids:contains(bare_jid) then
|
||||
return true;
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
return {
|
||||
@@ -637,6 +647,7 @@ return {
|
||||
INBOUND_SIP_JIBRI_PREFIXES = INBOUND_SIP_JIBRI_PREFIXES;
|
||||
RECORDER_PREFIXES = RECORDER_PREFIXES;
|
||||
extract_subdomain = extract_subdomain;
|
||||
is_admin = is_admin;
|
||||
is_feature_allowed = is_feature_allowed;
|
||||
is_jibri = is_jibri;
|
||||
is_healthcheck_room = is_healthcheck_room;
|
||||
|
||||
Reference in New Issue
Block a user