Mercurial > prosody-modules
changeset 5427:d69c10327d6d
mod_http_oauth2: More functional functions
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 07 May 2023 19:11:20 +0200 (19 months ago) |
parents | f75d95f27da7 |
children | 07e166b34c4c |
files | mod_http_oauth2/mod_http_oauth2.lua |
diffstat | 1 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua Sun May 07 19:07:52 2023 +0200 +++ b/mod_http_oauth2/mod_http_oauth2.lua Sun May 07 19:11:20 2023 +0200 @@ -116,10 +116,14 @@ return usermanager.user_can_assume_role(username, module.host, requested_role); end +local function role_assumable_by(username) + return function(role) + return can_assume_role(username, role); + end +end + local function user_assumable_roles(username, requested_roles) - return array.filter(requested_roles, function(role) - return can_assume_role(username, role); - end); + return array.filter(requested_roles, role_assumable_by(username)); end local function select_role(username, requested_roles)