comparison mod_client_management/mod_client_management.lua @ 5595:eae5599bc0b4

mod_client_management: Add way to revoke (one) client by software This is a bit hacky but it works.
author Kim Alvefur <zash@zash.se>
date Fri, 14 Jul 2023 15:01:56 +0200
parents e9af6abf2b1e
children d2561c1d26f5
comparison
equal deleted inserted replaced
5594:e9af6abf2b1e 5595:eae5599bc0b4
309 return nil, "item-not-found"; 309 return nil, "item-not-found";
310 end 310 end
311 local ok = tokenauth.revoke_grant(username, c_id); 311 local ok = tokenauth.revoke_grant(username, c_id);
312 if not ok then return nil, "internal-server-error"; end 312 if not ok then return nil, "internal-server-error"; end
313 return true; 313 return true;
314 elseif c_type == "software" then
315 local active_clients = get_active_clients(username);
316 for _, client in ipairs(active_clients) do
317 if client.user_agent and client.user_agent.software == c_id then
318 return revoke_client_access(username, client.id);
319 end
320 end
314 end 321 end
315 end 322 end
316 323
317 return nil, "item-not-found"; 324 return nil, "item-not-found";
318 end 325 end