diff options
Diffstat (limited to 'libpiny/lib/Piny')
-rw-r--r-- | libpiny/lib/Piny/Repo.pm | 16 | ||||
-rw-r--r-- | libpiny/lib/Piny/User.pm | 4 | ||||
-rw-r--r-- | libpiny/lib/Piny/User/IkiWiki.pm | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/libpiny/lib/Piny/Repo.pm b/libpiny/lib/Piny/Repo.pm index cfa73bd..335843e 100644 --- a/libpiny/lib/Piny/Repo.pm +++ b/libpiny/lib/Piny/Repo.pm @@ -206,15 +206,15 @@ sub rebuild { unless( getgrnam("git-" . $s->name ) ) { system( "/usr/sbin/addgroup", "--quiet", "git-" . $s->name ) and die "Could not create repo group!"; system( "/usr/sbin/adduser", "--quiet", $s->owner->name, "git-" . $s->name ) and die "Could not add you to the repo group!"; - system( "/usr/sbin/adduser", "--quiet", "ikiwiki-" . $s->name, "git-" . $s->name ) and print "...But that's probably okay.\n"; + system( "/usr/sbin/adduser", "--quiet", "iki-" . $s->name, "git-" . $s->name ) and print "...But that's probably okay.\n"; }; - unless( getpwnam("ikiwiki-" . $s->name ) ) { - system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $s->name, "ikiwiki-" . $s->name ) and die "Could not create ikiwiki user!"; - system( "/usr/sbin/adduser", "--quiet", "ikiwiki-" . $s->name, "git-" . $s->name ) and die "Could not add ikiwiki user to the repo group!"; + unless( getpwnam("iki-" . $s->name ) ) { + system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $s->name, "iki-" . $s->name ) and die "Could not create ikiwiki user!"; + system( "/usr/sbin/adduser", "--quiet", "iki-" . $s->name, "git-" . $s->name ) and die "Could not add ikiwiki user to the repo group!"; }; - my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-" . $s->name ); + my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-" . $s->name ); foreach( "git-daemon-export-ok", "packed-refs" ) { open( TOUCH, ">", $s->path . "/" . $_ ) or die "Could not touch $_ for repo: $!"; @@ -314,7 +314,7 @@ sub destroy { system( "rm", "-rf", $s->secure_path, $s->ikiwiki_destdir, $s->ikiwiki_srcdir, "/etc/ikiwiki/piny/" . $s->name . ".setup", $s->path ); - my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-" . $s->name ); + my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-" . $s->name ); system( "deluser", "--remove-home", $ikiuser->name ); system( "delgroup", $ikiuser->name ); @@ -392,9 +392,9 @@ sub create { mkdir( $repo->path ) or die "The repo $name appears to already exist! ($!)"; - system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $name, "ikiwiki-$name" ) and die "Could not create ikiwiki user!"; + system( "/usr/sbin/adduser", "--quiet", "--system", "--group", "--gecos", $name, "iki-$name" ) and die "Could not create ikiwiki user!"; - my $ikiuser = Piny::User::IkiWiki->new( "name" => "ikiwiki-$name" ); + my $ikiuser = Piny::User::IkiWiki->new( "name" => "iki-$name" ); system( "/usr/sbin/addgroup", "--quiet", "git-$name" ) and die "Could not create repo group!"; diff --git a/libpiny/lib/Piny/User.pm b/libpiny/lib/Piny/User.pm index 780a698..f742f87 100644 --- a/libpiny/lib/Piny/User.pm +++ b/libpiny/lib/Piny/User.pm @@ -18,8 +18,8 @@ use Piny::Group; subtype 'Username' => as 'Str' - => where { $_ =~ /^(?!(git|ikiwiki)-)[a-zA-Z][a-zA-Z0-9_.-]*$/ } - => message { if ( /^((?:git|ikiwiki)-|[^a-zA-Z])/ ) { "Usernames are not allowed to begin with $1" } elsif ( /([^a-zA-Z0-9_.-])/ ) { "Usernames are not allowed to contain $1" } else { "Invalid username" } } + => where { $_ =~ /^(?!(git|iki)-)[a-zA-Z][a-zA-Z0-9_.-]*$/ } + => message { if ( /^((?:git|iki)-|[^a-zA-Z])/ ) { "Usernames are not allowed to begin with $1" } elsif ( /([^a-zA-Z0-9_.-])/ ) { "Usernames are not allowed to contain $1" } else { "Invalid username" } } ; # Attributes diff --git a/libpiny/lib/Piny/User/IkiWiki.pm b/libpiny/lib/Piny/User/IkiWiki.pm index 8585e90..3838f38 100644 --- a/libpiny/lib/Piny/User/IkiWiki.pm +++ b/libpiny/lib/Piny/User/IkiWiki.pm @@ -18,7 +18,7 @@ extends "Piny::User"; subtype 'IkiWikiUsername' => as 'Str' - => where { $_ =~ /^ikiwiki-[a-zA-Z][a-zA-Z0-9_.-]*$/ } + => where { $_ =~ /^iki-[a-zA-Z][a-zA-Z0-9_.-]*$/ } => message { 'That username is not in the correct format for an ikiwiki user.' } ; |