[Bps-public-commit] rt-authen-token branch, master, updated. 1df993e27f9b7855f347ee5fb2a187d1b7466827
? sunnavy
sunnavy at bestpractical.com
Mon Aug 3 14:46:20 EDT 2020
The branch, master has been updated
via 1df993e27f9b7855f347ee5fb2a187d1b7466827 (commit)
via 34859551618295861492aa5df69d18e23f9965d6 (commit)
via 938b67a1ff34034eb01a3b07656bbee4dfcbe95c (commit)
via 0075cf3d64c6707c730787f8adad7afd3827fe8c (commit)
via a75588d299a4dca8466affc117faaed748ec087a (commit)
via 7e42c897504502f4dccf1db5c61ec1b53827eba0 (commit)
via 3f40baf1772b819e041af78b85a09068da1d54f5 (commit)
from bf797b1a701a5f99e2ce9ac35e1960df0d5cd97d (commit)
Summary of changes:
Changes | 3 +++
META.yml | 6 +++---
Makefile.PL | 4 ++--
README | 9 ++++++++-
html/Elements/AuthToken/CreateForm | 6 +++++-
html/Elements/AuthToken/CreateResults | 8 ++++++--
inc/Module/Install.pm | 2 +-
inc/Module/Install/Base.pm | 2 +-
inc/Module/Install/Can.pm | 2 +-
inc/Module/Install/Fetch.pm | 2 +-
inc/Module/Install/Include.pm | 2 +-
inc/Module/Install/Makefile.pm | 2 +-
inc/Module/Install/Metadata.pm | 2 +-
inc/Module/Install/RTx.pm | 36 +++++++++++++++++++++++++----------
inc/Module/Install/RTx/Runtime.pm | 1 +
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
inc/YAML/Tiny.pm | 6 +++---
lib/RT/Authen/Token.pm | 12 ++++++++++--
19 files changed, 76 insertions(+), 33 deletions(-)
- Log -----------------------------------------------------------------
commit 3f40baf1772b819e041af78b85a09068da1d54f5
Author: Aaron Trevena <aaron at aarontrevena.co.uk>
Date: Tue Jun 23 19:27:05 2020 +0100
Add configuration to disable password check on creation of tokens
Added new behaviour and documentation, updated changelog
diff --git a/Changes b/Changes
index 3893a55..cbfb064 100644
--- a/Changes
+++ b/Changes
@@ -1,5 +1,9 @@
Revision history for RT-Authen-Token
+0.04 2020-06-24
+ - Don't require a password for token creation when RT is configured
+ with DisablePasswordForAuthToken set to true
+
0.03 2017-09-06
- Don't require a password for token creation when RT is configured
with External Authentication.
diff --git a/README b/README
index c1bfc93..05cb9e3 100644
--- a/README
+++ b/README
@@ -55,6 +55,14 @@ INSTALLATION
Restart your webserver
+CONFIGURATION
+
+ If you have a mix of local and external authentication you can disable
+ requiring a password to create tokens with the following line
+ in RT_SiteConfig.pm :
+
+ Set($DisablePasswordForAuthToken, 1);
+
AUTHOR
Best Practical Solutions, LLC <modules at bestpractical.com>
diff --git a/html/Elements/AuthToken/CreateForm b/html/Elements/AuthToken/CreateForm
index 72f1f6f..bfe21b4 100644
--- a/html/Elements/AuthToken/CreateForm
+++ b/html/Elements/AuthToken/CreateForm
@@ -6,6 +6,10 @@ $Description => ''
<%INIT>
# Don't require password for systems with some form of federated auth
my %res = $session{'CurrentUser'}->CurrentUserRequireToSetPassword();
+my $require_password = 1;
+if ( RT->Config->Get('DisablePasswordForAuthToken') or not $res{'CanSet'} ) {
+ $require_password = 0;
+}
</%INIT>
<form class="authtoken-form" method="post" data-ajax-url="<% RT->Config->Get('WebPath') %>/Helpers/AuthToken/Create">
% if ($Error) {
@@ -13,7 +17,7 @@ my %res = $session{'CurrentUser'}->CurrentUserRequireToSetPassword();
% }
<input type="hidden" name="Owner" value="<% $Owner %>">
<table>
-% if ( $res{'CanSet'} ){
+% if ( $require_password ){
<tr>
<td class="label"><&|/l, $session{'CurrentUser'}->Name()&>[_1]'s current password</&>:</td>
<td class="value"><input type="password" name="Password" size="16" autocomplete="off" /></td>
diff --git a/html/Elements/AuthToken/CreateResults b/html/Elements/AuthToken/CreateResults
index 3b98c1c..2365a03 100644
--- a/html/Elements/AuthToken/CreateResults
+++ b/html/Elements/AuthToken/CreateResults
@@ -7,6 +7,10 @@ $Description => ''
my $token = RT::AuthToken->new($session{CurrentUser});
# Don't require password for systems with some form of federated auth
my %res = $session{'CurrentUser'}->CurrentUserRequireToSetPassword();
+my $require_password = 1;
+if ( RT->Config->Get('DisablePasswordForAuthToken') or not $res{'CanSet'} ) {
+ $require_password = 0;
+}
my ($error, $authstring);
if (!$Owner) {
@@ -15,10 +19,10 @@ if (!$Owner) {
elsif (!length($Description)) {
$error = loc("Description cannot be blank.");
}
-elsif ($res{'CanSet'} && !length($Password)) {
+elsif ($require_password && !length($Password)) {
$error = loc("Please enter your current password.");
}
-elsif ($res{'CanSet'} && !$session{CurrentUser}->IsPassword($Password) ) {
+elsif ($require_password && !$session{CurrentUser}->IsPassword($Password) ) {
$error = loc("Please enter your current password correctly.");
}
else {
diff --git a/lib/RT/Authen/Token.pm b/lib/RT/Authen/Token.pm
index bac8d4d..879ce3e 100644
--- a/lib/RT/Authen/Token.pm
+++ b/lib/RT/Authen/Token.pm
@@ -112,6 +112,14 @@ Apache configuration to allow RT to access the Authorization header.
=back
+=head1 CONFIGURATION
+
+If you have a mix of local and external authentication you can disable
+requiring a password to create tokens with the following line
+in RT_SiteConfig.pm :
+
+ Set($DisablePasswordForAuthToken, 1);
+
=head1 AUTHOR
Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
commit 7e42c897504502f4dccf1db5c61ec1b53827eba0
Merge: bf797b1 3f40baf
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:30:16 2020 +0800
Merge branch 'new-config-option-disable-password'
commit a75588d299a4dca8466affc117faaed748ec087a
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:32:20 2020 +0800
Update M:I
diff --git a/META.yml b/META.yml
index 4c30f9a..f066bca 100644
--- a/META.yml
+++ b/META.yml
@@ -8,7 +8,7 @@ configure_requires:
ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.18'
+generated_by: 'Module::Install version 1.19'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -25,6 +25,6 @@ requires:
resources:
license: http://opensource.org/licenses/gpl-license.php
version: '0.03'
-x_module_install_rtx_version: '0.39'
+x_module_install_rtx_version: '0.42'
x_requires_rt: 4.2.5
x_rt_too_new: '4.6'
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 07525c5..7ba98c2 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.18';
+ $VERSION = '1.19';
# Storage for the pseudo-singleton
$MAIN = undef;
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b61d424..9fa42c2 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 1de368c..d65c753 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 54b52cb..3072b08 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 087da8d..13fdcd0 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 8ba3d88..13a4464 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 692ce71..11bf971 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 3268e7e..2dd9489 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -6,9 +6,10 @@ use strict;
use warnings;
no warnings 'once';
+use Term::ANSIColor qw(:constants);
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.39';
+our $VERSION = '0.42';
use FindBin;
use File::Glob ();
@@ -53,7 +54,7 @@ sub RTx {
my @look = @INC;
unshift @look, grep {defined and -d $_} @try;
push @look, grep {defined and -d $_}
- map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+ map { ( "$_/rt5/lib", "$_/lib/rt5", "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
warn
@@ -76,6 +77,22 @@ sub RTx {
$self->requires_rt('4.0.0');
}
+ my $package = $name;
+ $package =~ s/-/::/g;
+ if ( $RT::CORED_PLUGINS{$package} ) {
+ my ($base_version) = $RT::VERSION =~ /(\d+\.\d+\.\d+)/;
+ die RED, <<"EOT";
+
+**** Error: Your installed version of RT ($RT::VERSION) already
+ contains this extension in core, so you don't need to
+ install it.
+
+ Check https://docs.bestpractical.com/rt/$base_version/RT_Config.html
+ to configure it.
+
+EOT
+ }
+
# Installation locations
my %path;
my $plugin_path;
@@ -223,7 +240,7 @@ sub requires_rt {
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[-1] eq $version) {
- die <<"EOT";
+ die RED, <<"EOT";
**** Error: This extension requires RT $version. Your installed version
of RT ($RT::VERSION) is too old.
@@ -249,12 +266,12 @@ sub requires_rt_plugin {
unshift @INC, $path;
} else {
my $name = $self->name;
- warn <<"EOT";
+ my $msg = <<"EOT";
**** Warning: $name requires that the $plugin plugin be installed and
enabled; it does not appear to be installed.
-
EOT
+ warn RED, $msg, RESET, "\n";
}
$self->requires(@_);
}
@@ -264,9 +281,8 @@ sub rt_too_new {
my $name = $self->name;
$msg ||= <<EOT;
-**** Error: Your installed version of RT (%s) is too new; this extension
- only works with versions older than %s.
-
+**** Warning: Your installed version of RT (%s) is too new; this extension
+ has not been tested on your version of RT and may not work as expected.
EOT
$self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
@@ -274,7 +290,7 @@ EOT
my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[0] eq $version) {
- die sprintf($msg,$RT::VERSION,$version);
+ warn RED, sprintf($msg,$RT::VERSION), RESET, "\n";
}
}
@@ -297,4 +313,4 @@ sub _load_rt_handle {
__END__
-#line 468
+#line 484
diff --git a/inc/Module/Install/RTx/Runtime.pm b/inc/Module/Install/RTx/Runtime.pm
index 937949f..ae07502 100644
--- a/inc/Module/Install/RTx/Runtime.pm
+++ b/inc/Module/Install/RTx/Runtime.pm
@@ -33,6 +33,7 @@ sub RTxDatabase {
my $lib_path = File::Basename::dirname($INC{'RT.pm'});
my @args = (
+ "-I.",
"-Ilib",
"-I$RT::LocalLibPath",
"-I$lib_path",
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index b80c900..f7aa615 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index da279c7..2db861a 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.18';
+ $VERSION = '1.19';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/inc/YAML/Tiny.pm b/inc/YAML/Tiny.pm
index 4fd023d..fb157a6 100644
--- a/inc/YAML/Tiny.pm
+++ b/inc/YAML/Tiny.pm
@@ -2,12 +2,12 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
-package YAML::Tiny; # git description: v1.69-8-g2c1e266
+package YAML::Tiny; # git description: v1.72-7-g8682f63
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
# proven otherwise
-our $VERSION = '1.70';
+our $VERSION = '1.73';
#####################################################################
# The YAML::Tiny API.
@@ -374,7 +374,7 @@ sub _load_scalar {
while ( @$lines ) {
$lines->[0] =~ /^(\s*)/;
last unless length($1) >= $indent->[-1];
- push @multiline, substr(shift(@$lines), length($1));
+ push @multiline, substr(shift(@$lines), $indent->[-1]);
}
my $j = (substr($string, 0, 1) eq '>') ? ' ' : "\n";
commit 0075cf3d64c6707c730787f8adad7afd3827fe8c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:32:49 2020 +0800
Update copyright year to 2020
diff --git a/README b/README
index 05cb9e3..12f8e29 100644
--- a/README
+++ b/README
@@ -76,7 +76,7 @@ BUGS
L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Authen-Token>.
COPYRIGHT
- This extension is Copyright (C) 2017 Best Practical Solutions, LLC.
+ This extension is Copyright (C) 2017-2020 Best Practical Solutions, LLC.
This is free software, licensed under:
diff --git a/lib/RT/Authen/Token.pm b/lib/RT/Authen/Token.pm
index 879ce3e..c24505d 100644
--- a/lib/RT/Authen/Token.pm
+++ b/lib/RT/Authen/Token.pm
@@ -136,7 +136,7 @@ or via the web at
=head1 COPYRIGHT
-This extension is Copyright (C) 2017 Best Practical Solutions, LLC.
+This extension is Copyright (C) 2017-2020 Best Practical Solutions, LLC.
This is free software, licensed under:
commit 938b67a1ff34034eb01a3b07656bbee4dfcbe95c
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:37:05 2020 +0800
Add "." to @INC for perl 5.26+
diff --git a/Makefile.PL b/Makefile.PL
index 38829ab..29b2d7b 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,3 +1,4 @@
+use lib '.';
use inc::Module::Install;
RTx 'RT-Authen-Token';
commit 34859551618295861492aa5df69d18e23f9965d6
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:42:28 2020 +0800
Fix signature process
"sign" needs to be before "WriteAll"
diff --git a/Makefile.PL b/Makefile.PL
index 29b2d7b..d901af8 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -6,6 +6,5 @@ RTx 'RT-Authen-Token';
requires_rt '4.2.5';
rt_too_new '4.6';
-WriteAll;
sign;
-
+WriteAll;
commit 1df993e27f9b7855f347ee5fb2a187d1b7466827
Author: sunnavy <sunnavy at bestpractical.com>
Date: Tue Aug 4 02:39:59 2020 +0800
Prep 0.04
diff --git a/Changes b/Changes
index cbfb064..56d7bcf 100644
--- a/Changes
+++ b/Changes
@@ -1,8 +1,7 @@
Revision history for RT-Authen-Token
-0.04 2020-06-24
- - Don't require a password for token creation when RT is configured
- with DisablePasswordForAuthToken set to true
+0.04 2020-08-03
+ - Add config $DisablePasswordForAuthToken to not require a password for token creation
0.03 2017-09-06
- Don't require a password for token creation when RT is configured
diff --git a/META.yml b/META.yml
index f066bca..aede7f8 100644
--- a/META.yml
+++ b/META.yml
@@ -24,7 +24,7 @@ requires:
perl: 5.10.1
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: '0.03'
+version: '0.04'
x_module_install_rtx_version: '0.42'
x_requires_rt: 4.2.5
x_rt_too_new: '4.6'
diff --git a/README b/README
index 12f8e29..abdd6ee 100644
--- a/README
+++ b/README
@@ -56,10 +56,9 @@ INSTALLATION
Restart your webserver
CONFIGURATION
-
If you have a mix of local and external authentication you can disable
- requiring a password to create tokens with the following line
- in RT_SiteConfig.pm :
+ requiring a password to create tokens with the following line in
+ RT_SiteConfig.pm :
Set($DisablePasswordForAuthToken, 1);
diff --git a/lib/RT/Authen/Token.pm b/lib/RT/Authen/Token.pm
index c24505d..c7f5f61 100644
--- a/lib/RT/Authen/Token.pm
+++ b/lib/RT/Authen/Token.pm
@@ -2,7 +2,7 @@ package RT::Authen::Token;
use strict;
use warnings;
-our $VERSION = '0.03';
+our $VERSION = '0.04';
RT::System->AddRight(Staff => ManageAuthTokens => 'Manage authentication tokens');
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list