Skip to content

Commit

Permalink
fix(jwt): Fixes when feature is missing.
Browse files Browse the repository at this point in the history
There are cases where features is initialized with empty table, so we need to take into account that the key is missing in the table.
  • Loading branch information
damencho committed Oct 1, 2024
1 parent 8d5d3f0 commit d5f76be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions resources/prosody-plugins/util.lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@ end
-- If features are missing but we have granted_features check that
-- if features are missing from the token we check whether it is moderator
function is_feature_allowed(ft, features, granted_features, is_moderator)
if features then
if features and features[ft] ~= nil then
return features[ft] == "true" or features[ft] == true;
elseif granted_features then
elseif granted_features and granted_features[ft] ~= nil then
return granted_features[ft] == "true" or granted_features[ft] == true;
else
return is_moderator;
Expand Down

0 comments on commit d5f76be

Please sign in to comment.