Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Revamp the user list setup page. Show the last change time and expiration date for each login. Make the user list sortable using javascript. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
01b1319931e282166dbd3e8b6defd91e |
| User & Date: | drh 2015-11-17 19:52:58.937 |
Context
|
2015-11-17
| ||
| 19:58 | Add the Access-Log submenu button to the User List page. check-in: e60a021167 user: drh tags: trunk | |
| 19:52 | Revamp the user list setup page. Show the last change time and expiration date for each login. Make the user list sortable using javascript. check-in: 01b1319931 user: drh tags: trunk | |
| 19:51 | Change the user list to a sortable table. Closed-Leaf check-in: 72de3100c2 user: drh tags: user-config-revamp | |
|
2015-11-14
| ||
| 19:03 | Fix a memcmp() that really should be fossil_strcmp(). check-in: 5853fcf132 user: drh tags: trunk | |
Changes
Changes to src/setup.c.
| ︙ | ︙ | |||
151 152 153 154 155 156 157 158 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_submenu_element("Add", "Add User", "setup_uedit");
style_header("User List");
| > | < | | < | < < | | | | > | < < | > > > | | > > > > > > > > | > > | < | < | > | > > > > > > > | > > > > > | > > > > > > > > > > > | < < | < < < < < < < > | | | < < < | < | | | > > | < < | | > | > > > > > > > | | 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 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 |
login_check_credentials();
if( !g.perm.Admin ){
login_needed(0);
return;
}
style_submenu_element("Add", "Add User", "setup_uedit");
style_submenu_element("Help", "Help", "setup_ulist_notes");
style_header("User List");
@ <table border=1 cellpadding=2 cellspacing=0 class='userTable'>
@ <thead><tr><th>UID <th>Category <th>Capabilities <th>Info <th>Last Change</tr></thead>
@ <tbody>
db_prepare(&s,
"SELECT uid, login, cap, date(mtime,'unixepoch')"
" FROM user"
" WHERE login IN ('anonymous','nobody','developer','reader')"
" ORDER BY login"
);
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 *zDate = db_column_text(&s, 4);
@ <tr>
@ <td><a href='setup_uedit?id=%d(uid)'>%d(uid)</a>
@ <td><a href='setup_uedit?id=%d(uid)'>%h(zLogin)</a>
@ <td>%h(zCap)
if( fossil_strcmp(zLogin,"anonymous")==0 ){
@ <td>All logged-in users
}else if( fossil_strcmp(zLogin,"developer")==0 ){
@ <td>Users with '<b>v</b>' capability
}else if( fossil_strcmp(zLogin,"nobody")==0 ){
@ <td>All users without login
}else if( fossil_strcmp(zLogin,"reader")==0 ){
@ <td>Users with '<b>u</b>' capability
}else{
@ <td>
}
if( zDate && zDate[0] ){
@ <td>%h(zDate)
}else{
@ <td>
}
@ </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<th>Caps<th>Info<th>Chng<th>Expire</tr></thead>
@ <tbody>
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"
" FROM user"
" WHERE login NOT IN ('anonymous','nobody','developer','reader')"
" ORDER BY sortkey"
);
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);
@ <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:"")
@ </tr>
}
@ </tbody></table>
db_finalize(&s);
output_table_sorting_javascript("userlist","nktxTT",2);
style_footer();
}
/*
** WEBPAGE: setup_ulist_notes
**
** A documentation page showing notes about user configuration. This information
** used to be a side-bar on the user list page, but has been factored out for
** improved presentation.
*/
void setup_ulist_notes(void){
style_header("User Configuration Notes");
@ <h1>User Configuration Notes:</h1>
@ <ol>
@ <li><p>The permission flags are as follows:</p>
@ <table>
@ <tr><th valign="top">a</th>
@ <td><i>Admin:</i> Create and delete users</td></tr>
@ <tr><th valign="top">b</th>
@ <td><i>Attach:</i> Add attachments to wiki or tickets</td></tr>
|
| ︙ | ︙ | |||
293 294 295 296 297 298 299 | @ Users with privilege <span class="capability">v</span> inherit the combined @ privileges of <span class="usertype">developer</span>, @ <span class="usertype">anonymous</span>, and @ <span class="usertype">nobody</span>. @ </p></li> @ @ </ol> | < < > | 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | @ Users with privilege <span class="capability">v</span> inherit the combined @ privileges of <span class="usertype">developer</span>, @ <span class="usertype">anonymous</span>, and @ <span class="usertype">nobody</span>. @ </p></li> @ @ </ol> style_footer(); } /* ** Return true if zPw is a valid password string. A valid ** password string is: ** ** (1) A zero-length string, or ** (2) a string that contains a character other than '*'. |
| ︙ | ︙ |