Differences From:
File
src/setup.c
part of check-in
[92f6d3d786]
- Improved explanation of privileges on the User Edit screen.
by
drh on
2008-07-19 15:40:31.
[view]
To:
File
src/setup.c
part of check-in
[f8831f447a]
- Allow Admin user to changes user information. Add a "User" link on the
main menu for Admin users.
by
drh on
2008-07-19 16:03:02.
[view]
@@ -94,9 +94,9 @@
void setup_ulist(void){
Stmt s;
login_check_credentials();
- if( !g.okSetup ){
+ if( !g.okAdmin ){
login_needed();
return;
}
@@ -113,19 +113,21 @@
@ <th>Contact Info</th>
@ </tr>
db_prepare(&s, "SELECT uid, login, cap, info FROM user ORDER BY login");
while( db_step(&s)==SQLITE_ROW ){
+ const char *zCap = db_column_text(&s, 2);
+ if( strstr(zCap, "s") ) zCap = "s";
@ <tr>
@ <td align="right">
- if( g.okAdmin ){
+ if( g.okAdmin && (zCap[0]!='s' || g.okSetup) ){
@ <a href="setup_uedit?id=%d(db_column_int(&s,0))">
}
@ <nobr>%h(db_column_text(&s,1))</nobr>
if( g.okAdmin ){
@ </a>
}
@ </td><td> </td>
- @ <td align="center">%s(db_column_text(&s,2))</td>
+ @ <td align="center">%s(zCap)</td>
@ <td> </td>
@ <td align="left">%s(db_column_text(&s,3))</td>
@ </tr>
}
@@ -192,9 +194,9 @@
zId = PD("id", "0");
uid = atoi(zId);
if( zId && !g.okSetup && uid>0 ){
char *zOldCaps;
- zOldCaps = db_text(0, "SELECT caps FROM user WHERE uid=%d",uid);
+ zOldCaps = db_text(0, "SELECT cap FROM user WHERE uid=%d",uid);
higherUser = zOldCaps && strchr(zOldCaps,'s');
}
if( P("can") ){
@@ -371,20 +373,20 @@
@ </table></td></tr></table>
@ <p><b>Notes:</b></p>
@ <ol>
if( higherUser ){
- @ <li><p>
- @ User %h(zId) has Setup privileges and you only have Admin privileges
- @ so you are not permitted to make changes to %h(zId).
- @ </p></li>
+ @ <li><p><font color="blue"><b>
+ @ User %h(zLogin) has Setup privileges and you only have Admin privileges
+ @ so you are not permitted to make changes to %h(zLogin).
+ @ </b></font></p></li>
@
}
@
@ <li><p>
@ The <b>Setup</b> user can make arbitrary configuration changes.
@ An <b>Admin</b> user can add other users and change user privileges
- @ and reset user passwords.
- @ Use these two settings with discretion.
+ @ and reset user passwords. Both automatically get all other privileges
+ @ listed below. Use these two settings with discretion.
@ </p></li>
@
@ <li><p>
@ The <b>Delete</b> privilege give the user the ability to erase