summaryrefslogtreecommitdiff
path: root/usr/src/libpiny/lib/Piny/User.pm
diff options
context:
space:
mode:
authorJulian Blake Kongslie <jblake@omgwallhack.org>2010-07-07 14:07:06 -0700
committerJulian Blake Kongslie <jblake@omgwallhack.org>2010-07-07 14:07:06 -0700
commit4fa79cd01321b079ad94c6041038bd3a7dcc0958 (patch)
tree5c55ffa7d5f06827a18a9c38e953226160530fa9 /usr/src/libpiny/lib/Piny/User.pm
parent7b243125659e9a13126198b2b790a697552d59e5 (diff)
downloadpiny-code-4fa79cd01321b079ad94c6041038bd3a7dcc0958.tar.gz
piny-code-4fa79cd01321b079ad94c6041038bd3a7dcc0958.zip
Lots more ikiwiki integration stuff in libpiny.
Diffstat (limited to 'usr/src/libpiny/lib/Piny/User.pm')
-rw-r--r--usr/src/libpiny/lib/Piny/User.pm24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr/src/libpiny/lib/Piny/User.pm b/usr/src/libpiny/lib/Piny/User.pm
index 559adfd..173b592 100644
--- a/usr/src/libpiny/lib/Piny/User.pm
+++ b/usr/src/libpiny/lib/Piny/User.pm
@@ -25,7 +25,7 @@ has 'uid' =>
, lazy_build => 1
);
-has 'username' =>
+has 'name' =>
( is => 'ro'
, isa => 'Username'
, lazy_build => 1
@@ -100,7 +100,7 @@ sub all_users {
eval {
my $user = $class->new( uid => $info[2] );
# Some forced early evaluation, so error checking happens now.
- $user->username( );
+ $user->name( );
$user->email( );
push( @ret, $user );
};
@@ -123,7 +123,7 @@ around BUILDARGS => sub {
if ( $_[0] =~ m/^\d+$/ ) {
return $class->$orig( uid => $_[0] );
} else {
- return $class->$orig( username => $_[0] );
+ return $class->$orig( name => $_[0] );
};
} else {
return $class->$orig( @_ );
@@ -133,12 +133,12 @@ around BUILDARGS => sub {
sub BUILD {
my ( $s ) = @_;
- if ( not ( $s->has_uid( ) or $s->has_username( ) ) ) {
- die "You must provide either UID or username!";
+ if ( not ( $s->has_uid( ) or $s->has_name( ) ) ) {
+ die "You must provide either UID or name!";
};
- if ( $s->has_uid( ) and $s->has_username( ) ) {
- die "You must not provide both UID and username!";
+ if ( $s->has_uid( ) and $s->has_name( ) ) {
+ die "You must not provide both UID and name!";
};
};
@@ -148,7 +148,7 @@ sub _build_uid {
return $s->pwent( )->[2];
};
-sub _build_username {
+sub _build_name {
my ( $s ) = @_;
return $s->pwent( )->[0];
@@ -161,9 +161,9 @@ sub _build_pwent {
my @res = getpwuid( $s->uid( ) );
die "getpwuid( " . $s->uid( ) . " ) failed: $!" unless @res;
return \@res;
- } elsif ( $s->has_username( ) ) {
- my @res = getpwnam( $s->username( ) );
- die "getpwnam( " . $s->username( ) . " ) failed: $!" unless @res;
+ } elsif ( $s->has_name( ) ) {
+ my @res = getpwnam( $s->name( ) );
+ die "getpwnam( " . $s->name( ) . " ) failed: $!" unless @res;
return \@res;
} else {
die "Not enough information provided to lookup user!";
@@ -193,7 +193,7 @@ sub _build_groups {
while ( @ent = getgrent( ) ) {
next if ( $ent[3] eq "" );
foreach my $member ( split( / /, $ent[3] ) ) {
- if ( $member eq $s->username( ) ) {
+ if ( $member eq $s->name( ) ) {
push @res, Piny::Group->new( gid => $ent[2] );
last;
};