[Bps-public-commit] rt-extension-dynamicwebpath branch master updated. 0.01-1-g87b3b66
BPS Git Server
git at git.bestpractical.com
Thu Apr 27 13:49:51 UTC 2023
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "rt-extension-dynamicwebpath".
The branch, master has been updated
via 87b3b669dcb15d559db97ed951d234100e2162cd (commit)
from 39583ef273e08ee3b4d951634ff32ad7fa6eb8b0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 87b3b669dcb15d559db97ed951d234100e2162cd
Author: sunnavy <sunnavy at bestpractical.com>
Date: Thu Apr 27 21:13:56 2023 +0800
Automatically set configs defined for default WebPath ""
Previously all configs defined in "DynamicWebPath" were only set on
WebPath change, so if WebPath didn't change(e.g. no requests to
alternative WebPaths), no configs would be set. This required admin to
explicitly set configs defined for default WebPath(key is '') in site
config.
With this change, admin won't need to duplicate configs for default
WebPath.
diff --git a/lib/RT/Extension/DynamicWebPath.pm b/lib/RT/Extension/DynamicWebPath.pm
index 9e80530..fc10c21 100644
--- a/lib/RT/Extension/DynamicWebPath.pm
+++ b/lib/RT/Extension/DynamicWebPath.pm
@@ -4,6 +4,22 @@ package RT::Extension::DynamicWebPath;
our $VERSION = '0.01';
+use RT::Config;
+$RT::Config::META{DynamicWebPath} = {
+ Immutable => 1,
+ Type => 'HASH',
+ PostLoadCheck => sub {
+ my $config = shift;
+ my $paths = $config->Get('DynamicWebPath') || {};
+
+ if ( my $default = $paths->{''} ) {
+ for my $name ( keys %$default ) {
+ RT->Config->Set( $name => $default->{$name} );
+ }
+ }
+ }
+};
+
=head1 NAME
RT-Extension-DynamicWebPath - Dynamic WebPath
diff --git a/xt/basic.t b/xt/basic.t
index 2c9a357..29b41b0 100644
--- a/xt/basic.t
+++ b/xt/basic.t
@@ -6,11 +6,8 @@ use RT::Extension::DynamicWebPath::Test tests => undef;
plan skip_all => 'This test only works for RT_TEST_WEB_HANDLER=apache+fcgid'
unless ( $ENV{RT_TEST_WEB_HANDLER} // '' ) eq 'apache+fcgid';
-RT->Config->Set( WebRemoteUserAuth => 1 );
-RT->Config->Set( WebFallbackToRTLogin => 0 );
-
RT->Config->Set(
- 'DynamicWebPath' => {
+ 'DynamicWebPath' => (
'' => {
WebRemoteUserAuth => 1,
WebFallbackToRTLogin => 0,
@@ -18,8 +15,8 @@ RT->Config->Set(
'/rt' => {
WebRemoteUserAuth => 0,
WebFallbackToRTLogin => 1,
- },
- },
+ }
+ ),
);
my $autoreply = RT::Template->new( RT->SystemUser );
-----------------------------------------------------------------------
Summary of changes:
lib/RT/Extension/DynamicWebPath.pm | 16 ++++++++++++++++
xt/basic.t | 9 +++------
2 files changed, 19 insertions(+), 6 deletions(-)
hooks/post-receive
--
rt-extension-dynamicwebpath
More information about the Bps-public-commit
mailing list