Comparison

plugins/mod_auth_internal_hashed.lua @ 12903:13950bf92802

mod_auth_internal_hashed: Implement methods to enable and disable users
author Kim Alvefur <zash@zash.se>
date Thu, 23 Feb 2023 14:44:35 +0100
parent 12902:0a0a251bcd6c
child 12916:5a06d07596f9
comparison
equal deleted inserted replaced
12902:0a0a251bcd6c 12903:13950bf92802
115 local info, err = provider.get_account_info(username); 115 local info, err = provider.get_account_info(username);
116 if not info then return nil, err; end 116 if not info then return nil, err; end
117 return info.enabled; 117 return info.enabled;
118 end 118 end
119 119
120 function provider.enable(username) -- luacheck: ignore 212 120 function provider.enable(username)
121 error "NYI" 121 -- TODO map store?
122 local account = accounts:get(username);
123 account.disabled = nil;
124 return accounts:set(username, account);
122 end 125 end
123 126
124 function provider.disable(username) -- luacheck: ignore 212 127 function provider.disable(username)
125 error "NYI" 128 local account = accounts:get(username);
129 account.disabled = true;
130 return accounts:set(username, account);
126 end 131 end
127 132
128 function provider.users() 133 function provider.users()
129 return accounts:users(); 134 return accounts:users();
130 end 135 end