Software /
code /
prosody
Comparison
plugins/mod_tokenauth.lua @ 13209:c8d949cf6b09
plugins: Switch to :get_option_period() for time range options
Improves readability ("1 day" vs 86400) and centralizes validation.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 16 Jul 2023 20:49:33 +0200 |
parent | 13099:a1ba503610ed |
child | 13246:2e04d54fb013 |
comparison
equal
deleted
inserted
replaced
13208:a7c6ea1c5308 | 13209:c8d949cf6b09 |
---|---|
6 local usermanager = require "prosody.core.usermanager"; | 6 local usermanager = require "prosody.core.usermanager"; |
7 local generate_identifier = require "prosody.util.id".short; | 7 local generate_identifier = require "prosody.util.id".short; |
8 | 8 |
9 local token_store = module:open_store("auth_tokens", "keyval+"); | 9 local token_store = module:open_store("auth_tokens", "keyval+"); |
10 | 10 |
11 local access_time_granularity = module:get_option_number("token_auth_access_time_granularity", 60); | 11 local access_time_granularity = module:get_option_period("token_auth_access_time_granularity", 60); |
12 | 12 |
13 local function select_role(username, host, role_name) | 13 local function select_role(username, host, role_name) |
14 if not role_name then return end | 14 if not role_name then return end |
15 local role = usermanager.get_role_by_name(role_name, host); | 15 local role = usermanager.get_role_by_name(role_name, host); |
16 if not role then return end | 16 if not role then return end |