Comparison

plugins/mod_authz_internal.lua @ 12920:cdb996637b08

authz: Add method for retrieving all roles Some of the OAuth stuff highlights a small need to retrieve a list of roles somehow. Handy if you ever need a role selector in adhoc or something. Unless there's some O(n) thing we were avoiding?
author Kim Alvefur <zash@zash.se>
date Sat, 04 Mar 2023 18:40:43 +0100
parent 12740:f58c6ae5edc1
child 12925:6cb339423928
comparison
equal deleted inserted replaced
12919:7c0e5c7eff7c 12920:cdb996637b08
276 return role:set_permission(action, policy); 276 return role:set_permission(action, policy);
277 end 277 end
278 278
279 function get_role_by_name(role_name) 279 function get_role_by_name(role_name)
280 return assert(role_registry[role_name], role_name); 280 return assert(role_registry[role_name], role_name);
281 end
282
283 function get_all_roles()
284 return role_registry;
281 end 285 end
282 286
283 -- COMPAT: Migrate from 0.12 role storage 287 -- COMPAT: Migrate from 0.12 role storage
284 local function do_migration(migrate_host) 288 local function do_migration(migrate_host)
285 local old_role_store = assert(module:context(migrate_host):open_store("roles")); 289 local old_role_store = assert(module:context(migrate_host):open_store("roles"));