Fossil SCM

The /setup page can now be seen by both Admin and Setup users, as requested by drh via private email. The set of links shown is culled for Admin-only users. Also changed some comments to match the code with respect to Admin vs Setup capability. The only change to user capability interpretation in this checkin is to the /setup page.

wyoung 2018-11-28 18:57 trunk
Commit 7d034d34bac75213c7d517065ff6c1b8e87fdbbfce065ef469aea0dcaaf9d4e9
2 files changed +1 -1 +51 -35
+1 -1
--- src/cache.c
+++ src/cache.c
@@ -344,11 +344,11 @@
344344
}
345345
346346
/*
347347
** WEBPAGE: cachestat
348348
**
349
-** Show information about the webpage cache. Requires Admin privilege.
349
+** Show information about the webpage cache. Requires Setup privilege.
350350
*/
351351
void cache_page(void){
352352
sqlite3 *db;
353353
sqlite3_stmt *pStmt;
354354
char zBuf[100];
355355
--- src/cache.c
+++ src/cache.c
@@ -344,11 +344,11 @@
344 }
345
346 /*
347 ** WEBPAGE: cachestat
348 **
349 ** Show information about the webpage cache. Requires Admin privilege.
350 */
351 void cache_page(void){
352 sqlite3 *db;
353 sqlite3_stmt *pStmt;
354 char zBuf[100];
355
--- src/cache.c
+++ src/cache.c
@@ -344,11 +344,11 @@
344 }
345
346 /*
347 ** WEBPAGE: cachestat
348 **
349 ** Show information about the webpage cache. Requires Setup privilege.
350 */
351 void cache_page(void){
352 sqlite3 *db;
353 sqlite3_stmt *pStmt;
354 char zBuf[100];
355
+51 -35
--- src/setup.c
+++ src/setup.c
@@ -59,17 +59,21 @@
5959
6060
6161
/*
6262
** WEBPAGE: setup
6363
**
64
-** Main menu for the administrative pages. Requires Admin privileges.
64
+** Main menu for the administrative pages. Requires Admin or Setup
65
+** privileges. Links to sub-pages only usable by Setup users are
66
+** shown only to Setup users.
6567
*/
6668
void setup_page(void){
69
+ int setup_user = 0;
6770
login_check_credentials();
68
- if( !g.perm.Setup ){
71
+ if( !g.perm.Admin ){
6972
login_needed(0);
7073
}
74
+ setup_user = g.perm.Setup;
7175
7276
style_header("Server Administration");
7377
7478
/* Make sure the header contains <base href="...">. Issue a warning
7579
** if it does not. */
@@ -95,48 +99,58 @@
9599
#endif
96100
97101
@ <table border="0" cellspacing="3">
98102
setup_menu_entry("Users", "setup_ulist",
99103
"Grant privileges to individual users.");
100
- setup_menu_entry("Access", "setup_access",
101
- "Control access settings.");
102
- setup_menu_entry("Configuration", "setup_config",
103
- "Configure the WWW components of the repository");
104
+ if( setup_user ){
105
+ setup_menu_entry("Access", "setup_access",
106
+ "Control access settings.");
107
+ setup_menu_entry("Configuration", "setup_config",
108
+ "Configure the WWW components of the repository");
109
+ }
104110
setup_menu_entry("Security-Audit", "secaudit0",
105111
"Analyze the current configuration for security problems");
106
- setup_menu_entry("Settings", "setup_settings",
107
- "Web interface to the \"fossil settings\" command");
108
- setup_menu_entry("Timeline", "setup_timeline",
109
- "Timeline display preferences");
110
- setup_menu_entry("Login-Group", "setup_login_group",
111
- "Manage single sign-on between this repository and others"
112
- " on the same server");
113
- setup_menu_entry("Tickets", "tktsetup",
114
- "Configure the trouble-ticketing system for this repository");
112
+ if( setup_user ){
113
+ setup_menu_entry("Settings", "setup_settings",
114
+ "Web interface to the \"fossil settings\" command");
115
+ setup_menu_entry("Timeline", "setup_timeline",
116
+ "Timeline display preferences");
117
+ setup_menu_entry("Login-Group", "setup_login_group",
118
+ "Manage single sign-on between this repository and others"
119
+ " on the same server");
120
+ setup_menu_entry("Tickets", "tktsetup",
121
+ "Configure the trouble-ticketing system for this repository");
122
+ }
115123
setup_menu_entry("Search","srchsetup",
116124
"Configure the built-in search engine");
117125
setup_menu_entry("URL Aliases", "waliassetup",
118126
"Configure URL aliases");
119
- setup_menu_entry("Notification", "setup_notification",
120
- "Automatic notifications of changes via outbound email");
121
- setup_menu_entry("Email-Server", "setup_smtp",
122
- "Activate and configure the built-in email server");
123
- setup_menu_entry("Transfers", "xfersetup",
124
- "Configure the transfer system for this repository");
127
+ if( setup_user ){
128
+ setup_menu_entry("Notification", "setup_notification",
129
+ "Automatic notifications of changes via outbound email");
130
+ setup_menu_entry("Email-Server", "setup_smtp",
131
+ "Activate and configure the built-in email server");
132
+ setup_menu_entry("Transfers", "xfersetup",
133
+ "Configure the transfer system for this repository");
134
+ }
125135
setup_menu_entry("Skins", "setup_skin",
126136
"Select and/or modify the web interface \"skins\"");
127137
setup_menu_entry("Moderation", "setup_modreq",
128138
"Enable/Disable requiring moderator approval of Wiki and/or Ticket"
129139
" changes and attachments.");
130
- setup_menu_entry("Ad-Unit", "setup_adunit",
131
- "Edit HTML text for an ad unit inserted after the menu bar");
140
+ if( setup_user ){
141
+ setup_menu_entry("Ad-Unit", "setup_adunit",
142
+ "Edit HTML text for an ad unit inserted after the menu bar");
143
+ }
132144
setup_menu_entry("URLs & Checkouts", "urllist",
133145
"Show URLs used to access this repo and known check-outs");
134
- setup_menu_entry("Web-Cache", "cachestat",
135
- "View the status of the expensive-page cache");
136
- setup_menu_entry("Logo", "setup_logo",
137
- "Change the logo and background images for the server");
146
+ if( setup_user ){
147
+ setup_menu_entry("Web-Cache", "cachestat",
148
+ "View the status of the expensive-page cache");
149
+ setup_menu_entry("Logo", "setup_logo",
150
+ "Change the logo and background images for the server");
151
+ }
138152
setup_menu_entry("Shunned", "shun",
139153
"Show artifacts that are shunned by this repository");
140154
setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
141155
"A record of received artifacts and their sources");
142156
setup_menu_entry("User Log", "access_log",
@@ -149,14 +163,16 @@
149163
"Show all unversioned files held");
150164
setup_menu_entry("Stats", "stat",
151165
"Repository Status Reports");
152166
setup_menu_entry("Sitemap", "sitemap",
153167
"Links to miscellaneous pages");
154
- setup_menu_entry("SQL", "admin_sql",
155
- "Enter raw SQL commands");
156
- setup_menu_entry("TH1", "admin_th1",
157
- "Enter raw TH1 commands");
168
+ if( setup_user ){
169
+ setup_menu_entry("SQL", "admin_sql",
170
+ "Enter raw SQL commands");
171
+ setup_menu_entry("TH1", "admin_th1",
172
+ "Enter raw TH1 commands");
173
+ }
158174
@ </table>
159175
160176
style_footer();
161177
}
162178
@@ -291,11 +307,11 @@
291307
292308
293309
/*
294310
** WEBPAGE: setup_access
295311
**
296
-** The access-control settings page. Requires Admin privileges.
312
+** The access-control settings page. Requires Setup privileges.
297313
*/
298314
void setup_access(void){
299315
login_check_credentials();
300316
if( !g.perm.Setup ){
301317
login_needed(0);
@@ -726,11 +742,11 @@
726742
727743
/*
728744
** WEBPAGE: setup_settings
729745
**
730746
** Change or view miscellaneous settings. Part of the
731
-** Admin pages requiring Admin privileges.
747
+** /setup pages requiring Setup privileges.
732748
*/
733749
void setup_settings(void){
734750
int nSetting;
735751
int i;
736752
Setting const *pSet;
@@ -813,11 +829,11 @@
813829
}
814830
815831
/*
816832
** WEBPAGE: setup_config
817833
**
818
-** The "Admin/Configuration" page. Requires Admin privilege.
834
+** The "Admin/Configuration" page. Requires Setup privilege.
819835
*/
820836
void setup_config(void){
821837
login_check_credentials();
822838
if( !g.perm.Setup ){
823839
login_needed(0);
@@ -1214,11 +1230,11 @@
12141230
12151231
/*
12161232
** WEBPAGE: admin_sql
12171233
**
12181234
** Run raw SQL commands against the database file using the web interface.
1219
-** Requires Admin privileges.
1235
+** Requires Setup privileges.
12201236
*/
12211237
void sql_page(void){
12221238
const char *zQ;
12231239
int go = P("go")!=0;
12241240
login_check_credentials();
12251241
--- src/setup.c
+++ src/setup.c
@@ -59,17 +59,21 @@
59
60
61 /*
62 ** WEBPAGE: setup
63 **
64 ** Main menu for the administrative pages. Requires Admin privileges.
 
 
65 */
66 void setup_page(void){
 
67 login_check_credentials();
68 if( !g.perm.Setup ){
69 login_needed(0);
70 }
 
71
72 style_header("Server Administration");
73
74 /* Make sure the header contains <base href="...">. Issue a warning
75 ** if it does not. */
@@ -95,48 +99,58 @@
95 #endif
96
97 @ <table border="0" cellspacing="3">
98 setup_menu_entry("Users", "setup_ulist",
99 "Grant privileges to individual users.");
100 setup_menu_entry("Access", "setup_access",
101 "Control access settings.");
102 setup_menu_entry("Configuration", "setup_config",
103 "Configure the WWW components of the repository");
 
 
104 setup_menu_entry("Security-Audit", "secaudit0",
105 "Analyze the current configuration for security problems");
106 setup_menu_entry("Settings", "setup_settings",
107 "Web interface to the \"fossil settings\" command");
108 setup_menu_entry("Timeline", "setup_timeline",
109 "Timeline display preferences");
110 setup_menu_entry("Login-Group", "setup_login_group",
111 "Manage single sign-on between this repository and others"
112 " on the same server");
113 setup_menu_entry("Tickets", "tktsetup",
114 "Configure the trouble-ticketing system for this repository");
 
 
115 setup_menu_entry("Search","srchsetup",
116 "Configure the built-in search engine");
117 setup_menu_entry("URL Aliases", "waliassetup",
118 "Configure URL aliases");
119 setup_menu_entry("Notification", "setup_notification",
120 "Automatic notifications of changes via outbound email");
121 setup_menu_entry("Email-Server", "setup_smtp",
122 "Activate and configure the built-in email server");
123 setup_menu_entry("Transfers", "xfersetup",
124 "Configure the transfer system for this repository");
 
 
125 setup_menu_entry("Skins", "setup_skin",
126 "Select and/or modify the web interface \"skins\"");
127 setup_menu_entry("Moderation", "setup_modreq",
128 "Enable/Disable requiring moderator approval of Wiki and/or Ticket"
129 " changes and attachments.");
130 setup_menu_entry("Ad-Unit", "setup_adunit",
131 "Edit HTML text for an ad unit inserted after the menu bar");
 
 
132 setup_menu_entry("URLs & Checkouts", "urllist",
133 "Show URLs used to access this repo and known check-outs");
134 setup_menu_entry("Web-Cache", "cachestat",
135 "View the status of the expensive-page cache");
136 setup_menu_entry("Logo", "setup_logo",
137 "Change the logo and background images for the server");
 
 
138 setup_menu_entry("Shunned", "shun",
139 "Show artifacts that are shunned by this repository");
140 setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
141 "A record of received artifacts and their sources");
142 setup_menu_entry("User Log", "access_log",
@@ -149,14 +163,16 @@
149 "Show all unversioned files held");
150 setup_menu_entry("Stats", "stat",
151 "Repository Status Reports");
152 setup_menu_entry("Sitemap", "sitemap",
153 "Links to miscellaneous pages");
154 setup_menu_entry("SQL", "admin_sql",
155 "Enter raw SQL commands");
156 setup_menu_entry("TH1", "admin_th1",
157 "Enter raw TH1 commands");
 
 
158 @ </table>
159
160 style_footer();
161 }
162
@@ -291,11 +307,11 @@
291
292
293 /*
294 ** WEBPAGE: setup_access
295 **
296 ** The access-control settings page. Requires Admin privileges.
297 */
298 void setup_access(void){
299 login_check_credentials();
300 if( !g.perm.Setup ){
301 login_needed(0);
@@ -726,11 +742,11 @@
726
727 /*
728 ** WEBPAGE: setup_settings
729 **
730 ** Change or view miscellaneous settings. Part of the
731 ** Admin pages requiring Admin privileges.
732 */
733 void setup_settings(void){
734 int nSetting;
735 int i;
736 Setting const *pSet;
@@ -813,11 +829,11 @@
813 }
814
815 /*
816 ** WEBPAGE: setup_config
817 **
818 ** The "Admin/Configuration" page. Requires Admin privilege.
819 */
820 void setup_config(void){
821 login_check_credentials();
822 if( !g.perm.Setup ){
823 login_needed(0);
@@ -1214,11 +1230,11 @@
1214
1215 /*
1216 ** WEBPAGE: admin_sql
1217 **
1218 ** Run raw SQL commands against the database file using the web interface.
1219 ** Requires Admin privileges.
1220 */
1221 void sql_page(void){
1222 const char *zQ;
1223 int go = P("go")!=0;
1224 login_check_credentials();
1225
--- src/setup.c
+++ src/setup.c
@@ -59,17 +59,21 @@
59
60
61 /*
62 ** WEBPAGE: setup
63 **
64 ** Main menu for the administrative pages. Requires Admin or Setup
65 ** privileges. Links to sub-pages only usable by Setup users are
66 ** shown only to Setup users.
67 */
68 void setup_page(void){
69 int setup_user = 0;
70 login_check_credentials();
71 if( !g.perm.Admin ){
72 login_needed(0);
73 }
74 setup_user = g.perm.Setup;
75
76 style_header("Server Administration");
77
78 /* Make sure the header contains <base href="...">. Issue a warning
79 ** if it does not. */
@@ -95,48 +99,58 @@
99 #endif
100
101 @ <table border="0" cellspacing="3">
102 setup_menu_entry("Users", "setup_ulist",
103 "Grant privileges to individual users.");
104 if( setup_user ){
105 setup_menu_entry("Access", "setup_access",
106 "Control access settings.");
107 setup_menu_entry("Configuration", "setup_config",
108 "Configure the WWW components of the repository");
109 }
110 setup_menu_entry("Security-Audit", "secaudit0",
111 "Analyze the current configuration for security problems");
112 if( setup_user ){
113 setup_menu_entry("Settings", "setup_settings",
114 "Web interface to the \"fossil settings\" command");
115 setup_menu_entry("Timeline", "setup_timeline",
116 "Timeline display preferences");
117 setup_menu_entry("Login-Group", "setup_login_group",
118 "Manage single sign-on between this repository and others"
119 " on the same server");
120 setup_menu_entry("Tickets", "tktsetup",
121 "Configure the trouble-ticketing system for this repository");
122 }
123 setup_menu_entry("Search","srchsetup",
124 "Configure the built-in search engine");
125 setup_menu_entry("URL Aliases", "waliassetup",
126 "Configure URL aliases");
127 if( setup_user ){
128 setup_menu_entry("Notification", "setup_notification",
129 "Automatic notifications of changes via outbound email");
130 setup_menu_entry("Email-Server", "setup_smtp",
131 "Activate and configure the built-in email server");
132 setup_menu_entry("Transfers", "xfersetup",
133 "Configure the transfer system for this repository");
134 }
135 setup_menu_entry("Skins", "setup_skin",
136 "Select and/or modify the web interface \"skins\"");
137 setup_menu_entry("Moderation", "setup_modreq",
138 "Enable/Disable requiring moderator approval of Wiki and/or Ticket"
139 " changes and attachments.");
140 if( setup_user ){
141 setup_menu_entry("Ad-Unit", "setup_adunit",
142 "Edit HTML text for an ad unit inserted after the menu bar");
143 }
144 setup_menu_entry("URLs & Checkouts", "urllist",
145 "Show URLs used to access this repo and known check-outs");
146 if( setup_user ){
147 setup_menu_entry("Web-Cache", "cachestat",
148 "View the status of the expensive-page cache");
149 setup_menu_entry("Logo", "setup_logo",
150 "Change the logo and background images for the server");
151 }
152 setup_menu_entry("Shunned", "shun",
153 "Show artifacts that are shunned by this repository");
154 setup_menu_entry("Artifact Receipts Log", "rcvfromlist",
155 "A record of received artifacts and their sources");
156 setup_menu_entry("User Log", "access_log",
@@ -149,14 +163,16 @@
163 "Show all unversioned files held");
164 setup_menu_entry("Stats", "stat",
165 "Repository Status Reports");
166 setup_menu_entry("Sitemap", "sitemap",
167 "Links to miscellaneous pages");
168 if( setup_user ){
169 setup_menu_entry("SQL", "admin_sql",
170 "Enter raw SQL commands");
171 setup_menu_entry("TH1", "admin_th1",
172 "Enter raw TH1 commands");
173 }
174 @ </table>
175
176 style_footer();
177 }
178
@@ -291,11 +307,11 @@
307
308
309 /*
310 ** WEBPAGE: setup_access
311 **
312 ** The access-control settings page. Requires Setup privileges.
313 */
314 void setup_access(void){
315 login_check_credentials();
316 if( !g.perm.Setup ){
317 login_needed(0);
@@ -726,11 +742,11 @@
742
743 /*
744 ** WEBPAGE: setup_settings
745 **
746 ** Change or view miscellaneous settings. Part of the
747 ** /setup pages requiring Setup privileges.
748 */
749 void setup_settings(void){
750 int nSetting;
751 int i;
752 Setting const *pSet;
@@ -813,11 +829,11 @@
829 }
830
831 /*
832 ** WEBPAGE: setup_config
833 **
834 ** The "Admin/Configuration" page. Requires Setup privilege.
835 */
836 void setup_config(void){
837 login_check_credentials();
838 if( !g.perm.Setup ){
839 login_needed(0);
@@ -1214,11 +1230,11 @@
1230
1231 /*
1232 ** WEBPAGE: admin_sql
1233 **
1234 ** Run raw SQL commands against the database file using the web interface.
1235 ** Requires Setup privileges.
1236 */
1237 void sql_page(void){
1238 const char *zQ;
1239 int go = P("go")!=0;
1240 login_check_credentials();
1241

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button