Skip to content

Commit

Permalink
Add uid method to account manager class.
Browse files Browse the repository at this point in the history
  • Loading branch information
racke committed Sep 23, 2011
1 parent ec7d1e1 commit 4c1accc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/Nitesi/Account/Manager.pm
Expand Up @@ -79,7 +79,7 @@ sub init_from_session {
my $self = shift;

$self->{account} = $self->{session_sub}->()
|| {username => '', permissions => ['anonymous']};
|| {uid => 0, username => '', permissions => ['anonymous']};

$self->{acl} = ACL::Lite->new(permissions => $self->{account}->{permissions});

Expand Down Expand Up @@ -118,6 +118,19 @@ sub logout {
$self->{session_sub}->('destroy');
}

=head2 uid
Retrieve user identifier, returns 0 if current user
isn't authenticated.
=cut

sub uid {
my $self = shift;

return $self->{account}->{uid};
}

=head2 username
Retrieve username. Returns empty string if current user
Expand Down

0 comments on commit 4c1accc

Please sign in to comment.