Fossil SCM

Add a setting in /Admin/Access that allows the /artifact_stats page to be accessed by any user. Activate load control on the /artifact_stats page.

drh 2020-02-13 18:28 trunk
Commit 86619b995dc31d951d8b88fdcb4cc9938e0497ca6405ee1314bea74fa6ccc7af
2 files changed +9 +3 -2
--- src/setup.c
+++ src/setup.c
@@ -374,10 +374,19 @@
374374
@ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
375375
@ users. When disabled (the default) only users Admin and Setup can visit
376376
@ the /test_env page.
377377
@ (Property: "test_env_enable")
378378
@ </p>
379
+ @
380
+ @ <hr />
381
+ onoff_attribute("Enable /artifact_stats",
382
+ "artifact_stats_enable", "artifact_stats_enable", 0, 0);
383
+ @ <p>When enabled, the %h(g.zBaseURL)/artifact_stats URL is available to all
384
+ @ users. When disabled (the default) only users with check-in privilege may
385
+ @ access the /artifact_stats page.
386
+ @ (Property: "artifact_stats_enable")
387
+ @ </p>
379388
@
380389
@ <hr />
381390
onoff_attribute("Allow REMOTE_USER authentication",
382391
"remote_user_ok", "remote_user_ok", 0, 0);
383392
@ <p>When enabled, if the REMOTE_USER environment variable is set to the
384393
--- src/setup.c
+++ src/setup.c
@@ -374,10 +374,19 @@
374 @ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
375 @ users. When disabled (the default) only users Admin and Setup can visit
376 @ the /test_env page.
377 @ (Property: "test_env_enable")
378 @ </p>
 
 
 
 
 
 
 
 
 
379 @
380 @ <hr />
381 onoff_attribute("Allow REMOTE_USER authentication",
382 "remote_user_ok", "remote_user_ok", 0, 0);
383 @ <p>When enabled, if the REMOTE_USER environment variable is set to the
384
--- src/setup.c
+++ src/setup.c
@@ -374,10 +374,19 @@
374 @ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all
375 @ users. When disabled (the default) only users Admin and Setup can visit
376 @ the /test_env page.
377 @ (Property: "test_env_enable")
378 @ </p>
379 @
380 @ <hr />
381 onoff_attribute("Enable /artifact_stats",
382 "artifact_stats_enable", "artifact_stats_enable", 0, 0);
383 @ <p>When enabled, the %h(g.zBaseURL)/artifact_stats URL is available to all
384 @ users. When disabled (the default) only users with check-in privilege may
385 @ access the /artifact_stats page.
386 @ (Property: "artifact_stats_enable")
387 @ </p>
388 @
389 @ <hr />
390 onoff_attribute("Allow REMOTE_USER authentication",
391 "remote_user_ok", "remote_user_ok", 0, 0);
392 @ <p>When enabled, if the REMOTE_USER environment variable is set to the
393
+3 -2
--- src/stat.c
+++ src/stat.c
@@ -766,14 +766,15 @@
766766
767767
/* These stats are expensive to compute. To disable them for
768768
** user without check-in privileges, to prevent excessive usage by
769769
** robots and random passers-by on the internet
770770
*/
771
- if( !g.perm.Write ){
772
- login_needed(g.anon.Admin);
771
+ if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
772
+ login_needed(g.anon.Write);
773773
return;
774774
}
775
+ load_control();
775776
776777
style_header("Artifact Statistics");
777778
style_submenu_element("Repository Stats", "stat");
778779
style_submenu_element("Artifact List", "bloblist");
779780
gather_artifact_stats(1);
780781
--- src/stat.c
+++ src/stat.c
@@ -766,14 +766,15 @@
766
767 /* These stats are expensive to compute. To disable them for
768 ** user without check-in privileges, to prevent excessive usage by
769 ** robots and random passers-by on the internet
770 */
771 if( !g.perm.Write ){
772 login_needed(g.anon.Admin);
773 return;
774 }
 
775
776 style_header("Artifact Statistics");
777 style_submenu_element("Repository Stats", "stat");
778 style_submenu_element("Artifact List", "bloblist");
779 gather_artifact_stats(1);
780
--- src/stat.c
+++ src/stat.c
@@ -766,14 +766,15 @@
766
767 /* These stats are expensive to compute. To disable them for
768 ** user without check-in privileges, to prevent excessive usage by
769 ** robots and random passers-by on the internet
770 */
771 if( !g.perm.Write && !db_get_boolean("artifact_stats_enable",0) ){
772 login_needed(g.anon.Write);
773 return;
774 }
775 load_control();
776
777 style_header("Artifact Statistics");
778 style_submenu_element("Repository Stats", "stat");
779 style_submenu_element("Artifact List", "bloblist");
780 gather_artifact_stats(1);
781

Keyboard Shortcuts

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