Mercurial > prosody-modules
comparison mod_auth_sql/mod_auth_sql.lua @ 843:cdc67f4efde2
mod_auth_sql: Add users iterator
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 05 Oct 2012 19:34:53 +0200 |
parents | 881ec9919144 |
children | 490cb9161c81 |
comparison
equal
deleted
inserted
replaced
842:32df4d13f178 | 843:cdc67f4efde2 |
---|---|
112 end | 112 end |
113 }; | 113 }; |
114 return new_sasl(module.host, profile); | 114 return new_sasl(module.host, profile); |
115 end | 115 end |
116 | 116 |
117 function provider.users() | |
118 local stmt, err = getsql("SELECT `username` FROM `authreg` WHERE `realm`=?", module.host); | |
119 if stmt then | |
120 local next, state = stmt:rows(true) | |
121 return function() | |
122 for row in next, state do | |
123 return row.username; | |
124 end | |
125 end | |
126 end | |
127 return stmt, err; | |
128 end | |
129 | |
130 | |
117 module:provides("auth", provider); | 131 module:provides("auth", provider); |