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.
Commit
86619b995dc31d951d8b88fdcb4cc9938e0497ca6405ee1314bea74fa6ccc7af
Parent
f7b34aac4f3fdc3…
2 files changed
+9
+3
-2
+9
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -374,10 +374,19 @@ | ||
| 374 | 374 | @ <p>When enabled, the %h(g.zBaseURL)/test_env URL is available to all |
| 375 | 375 | @ users. When disabled (the default) only users Admin and Setup can visit |
| 376 | 376 | @ the /test_env page. |
| 377 | 377 | @ (Property: "test_env_enable") |
| 378 | 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> | |
| 379 | 388 | @ |
| 380 | 389 | @ <hr /> |
| 381 | 390 | onoff_attribute("Allow REMOTE_USER authentication", |
| 382 | 391 | "remote_user_ok", "remote_user_ok", 0, 0); |
| 383 | 392 | @ <p>When enabled, if the REMOTE_USER environment variable is set to the |
| 384 | 393 |
| --- 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 @@ | ||
| 766 | 766 | |
| 767 | 767 | /* These stats are expensive to compute. To disable them for |
| 768 | 768 | ** user without check-in privileges, to prevent excessive usage by |
| 769 | 769 | ** robots and random passers-by on the internet |
| 770 | 770 | */ |
| 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); | |
| 773 | 773 | return; |
| 774 | 774 | } |
| 775 | + load_control(); | |
| 775 | 776 | |
| 776 | 777 | style_header("Artifact Statistics"); |
| 777 | 778 | style_submenu_element("Repository Stats", "stat"); |
| 778 | 779 | style_submenu_element("Artifact List", "bloblist"); |
| 779 | 780 | gather_artifact_stats(1); |
| 780 | 781 |
| --- 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 |