Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Add the "Last Login" column to the setup_ulist page. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5832d2fc6090572cd84c18021ea36f42 |
User & Date: | drh 2017-07-01 16:34:17.766 |
Context
2017-07-01
| ||
16:41 | Prevent line breaks in the "Last Login" column of the user list. ... (check-in: 2fe385e4 user: drh tags: trunk) | |
16:34 | Add the "Last Login" column to the setup_ulist page. ... (check-in: 5832d2fc user: drh tags: trunk) | |
03:08 | Typo fix in documentation. ... (check-in: 38f37679 user: drh tags: trunk) | |
Changes
Changes to src/setup.c.
︙ | ︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | ** WEBPAGE: setup_ulist ** ** Show a list of users. Clicking on any user jumps to the edit ** screen for that user. Requires Admin privileges. */ void setup_ulist(void){ Stmt s; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } | > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | ** WEBPAGE: setup_ulist ** ** Show a list of users. Clicking on any user jumps to the edit ** screen for that user. Requires Admin privileges. */ void setup_ulist(void){ Stmt s; double rNow; login_check_credentials(); if( !g.perm.Admin ){ login_needed(0); return; } |
︙ | ︙ | |||
196 197 198 199 200 201 202 | @ </tr> } db_finalize(&s); @ </tbody></table> @ <div class='section'>Users</div> @ <table border=1 cellpadding=2 cellspacing=0 class='userTable' id='userlist'> @ <thead><tr> | | > > > > > > > > > | > | > > > > > > > | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | @ </tr> } db_finalize(&s); @ </tbody></table> @ <div class='section'>Users</div> @ <table border=1 cellpadding=2 cellspacing=0 class='userTable' id='userlist'> @ <thead><tr> @ <th>ID<th>Login Name<th>Caps<th>Info<th>Date<th>Expire<th>Last Login</tr></thead> @ <tbody> db_multi_exec( "CREATE TEMP TABLE lastAccess(uname TEXT PRIMARY KEY, atime REAL) WITHOUT ROWID;" ); if( db_table_exists("repository","accesslog") ){ db_multi_exec( "INSERT INTO lastAccess(uname, atime)" " SELECT uname, max(mtime) FROM accesslog WHERE success GROUP BY uname;" ); } db_prepare(&s, "SELECT uid, login, cap, info, date(mtime,'unixepoch'), lower(login) AS sortkey, " " CASE WHEN info LIKE '%%expires 20%%'" " THEN substr(info,instr(lower(info),'expires')+8,10)" " END AS exp," "atime" " FROM user LEFT JOIN lastAccess ON login=uname" " WHERE login NOT IN ('anonymous','nobody','developer','reader')" " ORDER BY sortkey" ); rNow = db_double(0.0, "SELECT julianday('now');"); while( db_step(&s)==SQLITE_ROW ){ int uid = db_column_int(&s, 0); const char *zLogin = db_column_text(&s, 1); const char *zCap = db_column_text(&s, 2); const char *zInfo = db_column_text(&s, 3); const char *zDate = db_column_text(&s, 4); const char *zSortKey = db_column_text(&s,5); const char *zExp = db_column_text(&s,6); double rATime = db_column_double(&s,7); char *zAge = 0; if( rATime>0.0 ){ zAge = human_readable_age(rNow - rATime); } @ <tr> @ <td><a href='setup_uedit?id=%d(uid)'>%d(uid)</a> @ <td data-sortkey='%h(zSortKey)'><a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a> @ <td>%h(zCap) @ <td>%h(zInfo) @ <td>%h(zDate?zDate:"") @ <td>%h(zExp?zExp:"") @ <td data-sortkey='%f(rATime)'>%s(zAge?zAge:"") @ </tr> } @ </tbody></table> db_finalize(&s); output_table_sorting_javascript("userlist","nktxTTK",2); style_footer(); } /* ** Render the user-capability table */ static void setup_usercap_table(void){ |
︙ | ︙ |