# HG changeset patch # User Kim Alvefur # Date 1683479480 -7200 # Node ID d69c10327d6d7f5c8474362bb5c6e16f0b99afae # Parent f75d95f27da756ebab4445b31fb6f7862de342a4 mod_http_oauth2: More functional functions diff -r f75d95f27da7 -r d69c10327d6d mod_http_oauth2/mod_http_oauth2.lua --- 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)