Software /
code /
prosody
Comparison
plugins/mod_authz_internal.lua @ 12925:6cb339423928
mod_authz_internal: Fix wrong role name field in user_can_assume_role()
Made it reject the primary role since it compares against a non-existent
field, i.e. nil.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 09 Mar 2023 16:02:55 +0100 |
parent | 12920:cdb996637b08 |
child | 12977:74b9e05af71e |
comparison
equal
deleted
inserted
replaced
12924:ae0fba27fc24 | 12925:6cb339423928 |
---|---|
191 return stored_roles; | 191 return stored_roles; |
192 end | 192 end |
193 | 193 |
194 function user_can_assume_role(user, role_name) | 194 function user_can_assume_role(user, role_name) |
195 local primary_role = get_user_role(user); | 195 local primary_role = get_user_role(user); |
196 if primary_role and primary_role.role_name == role_name then | 196 if primary_role and primary_role.name == role_name then |
197 return true; | 197 return true; |
198 end | 198 end |
199 local secondary_roles = get_user_secondary_roles(user); | 199 local secondary_roles = get_user_secondary_roles(user); |
200 if secondary_roles and secondary_roles[role_name] then | 200 if secondary_roles and secondary_roles[role_name] then |
201 return true; | 201 return true; |