aboutsummaryrefslogtreecommitdiff
blob: ae5ce93a7a1066083d8cc47f13ccb87bc27559ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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#locations

*   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;