Software /
code /
prosody
Comparison
core/usermanager.lua @ 12663:cf88f6b03942
mod_authz_internal: Expose convenience method to test if user can assume role
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Thu, 18 Aug 2022 10:37:59 +0100 |
parent | 12662:07424992d7fc |
child | 12664:05d5f25a3c61 |
comparison
equal
deleted
inserted
replaced
12662:07424992d7fc | 12663:cf88f6b03942 |
---|---|
162 }); | 162 }); |
163 end | 163 end |
164 return role, err; | 164 return role, err; |
165 end | 165 end |
166 | 166 |
167 local function user_can_assume_role(user, host, role_name) | |
168 if host and not hosts[host] then return false; end | |
169 if type(user) ~= "string" then return false; end | |
170 | |
171 return hosts[host].authz.user_can_assume_role(user, role_name); | |
172 end | |
173 | |
167 local function add_user_secondary_role(user, host, role_name) | 174 local function add_user_secondary_role(user, host, role_name) |
168 if host and not hosts[host] then return false; end | 175 if host and not hosts[host] then return false; end |
169 if type(user) ~= "string" then return false; end | 176 if type(user) ~= "string" then return false; end |
170 | 177 |
171 local role, err = hosts[host].authz.add_user_secondary_role(user, role_name); | 178 local role, err = hosts[host].authz.add_user_secondary_role(user, role_name); |
258 users = users; | 265 users = users; |
259 get_sasl_handler = get_sasl_handler; | 266 get_sasl_handler = get_sasl_handler; |
260 get_provider = get_provider; | 267 get_provider = get_provider; |
261 get_user_role = get_user_role; | 268 get_user_role = get_user_role; |
262 set_user_role = set_user_role; | 269 set_user_role = set_user_role; |
270 user_can_assume_role = user_can_assume_role; | |
263 add_user_secondary_role = add_user_secondary_role; | 271 add_user_secondary_role = add_user_secondary_role; |
264 remove_user_secondary_role = remove_user_secondary_role; | 272 remove_user_secondary_role = remove_user_secondary_role; |
265 get_user_secondary_roles = get_user_secondary_roles; | 273 get_user_secondary_roles = get_user_secondary_roles; |
266 get_users_with_role = get_users_with_role; | 274 get_users_with_role = get_users_with_role; |
267 get_jid_role = get_jid_role; | 275 get_jid_role = get_jid_role; |