From aae1a14ea756102251351d96e2567b4986d30e2b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 16:17:27 +0200 Subject: Adding upstream version 3.6.12. Signed-off-by: Daniel Baumann --- contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm | 55 +++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm (limited to 'contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm') diff --git a/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm b/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm new file mode 100644 index 0000000..8fde513 --- /dev/null +++ b/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm @@ -0,0 +1,55 @@ +package Gitolite::Triggers::RedmineUserAlias; + +use Gitolite::Rc; +use Gitolite::Common; +use Gitolite::Conf::Load; + +use strict; +use warnings; + +# aliasing a redmine username to a more user-friendly one +# ---------------------------------------------------------------------- + +=for usage + +Why: + + Redmine creates users like "redmine_alice_123"; we want the users to just + see "alice" instead of that. + +Assumption: + +* Redmine does not allow duplicates in the middle bit; i.e., you can't + create redmine_alice_123 and redmine_alice_456 also. + +How: + +* add this code as lib/Gitolite/Triggers/RedmineUserAlias.pm to your + site-local code directory; see this link for how: + + http://gitolite.com/gitolite/non-core.html#ncloc + +* add the following to the rc file, just before the ENABLE section (don't + forget the trailing comma): + + INPUT => [ 'RedmineUserAlias::input' ], + +Notes: + +* http mode has not been tested and will not be. If someone has the time to + test it and make it work please let me know. + +* not tested with mirroring. + +Quote: + +* "All that for what is effectively one line of code. I need a life". + +=cut + +sub input { + $ARGV[0] or _die "no username???"; + $ARGV[0] =~ s/^redmine_(\S+)_\d+$/$1/; +} + +1; -- cgit v1.2.3