Mercurial > prosody-modules
changeset 5426:f75d95f27da7
mod_http_oauth2: Add function for filtering roles
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 07 May 2023 19:07:52 +0200 (19 months ago) |
parents | 3b30635d215c |
children | d69c10327d6d |
files | mod_http_oauth2/mod_http_oauth2.lua |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Sun May 07 19:29:15 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Sun May 07 19:07:52 2023 +0200 @@ -116,6 +116,12 @@ return usermanager.user_can_assume_role(username, module.host, requested_role); end +local function user_assumable_roles(username, requested_roles) + return array.filter(requested_roles, function(role) + return can_assume_role(username, role); + end); +end + local function select_role(username, requested_roles) if requested_roles then for _, requested_role in ipairs(requested_roles) do