NAME
CallBackery::User - tell me about the current user
SYNOPSIS
use CallBackery::User;
my $user = CallBackery::User->new($self->controller);
$user->werk;
$user->may('right'); # does the user have the given right
$user->id;
DESCRIPTION
All the methods if Mojo::Base as well as the following
$self->controller
the controller
$self->userId
By default the userId is numeric and represents a user account. For system tasks, it gets set to alphabetic identifiers. The following alphabetic identifiers do exist:
__CONSOLE when running in the config console mode
__CONFIG for backup and restore tasks
userId
return the user id if the session user is valid.
$self->db
a handle to a CallBackery::Database object.
$self->mojoSqlDb
returns a pointer to one of the Database object of a Mojo::Pg instance.
$self->userInfo
returns a hash of information about the current user.
$self->loginName
returns a human readable login name for the current user
$self->sessionConf
Extracts the session config from the cookie from the X-Session-Cookie header or the xsc parameter. If the xsc parameter is set, its timestamp must be no older than 2 seconds.
$user->login($login,$password)
login the user object. If login return 1 you can then makeSessionCookie.
$bool = $self->may
(right);
Check if the user has the right indicated.
makeSessionCookie()
Returns a timestamped, signed session cookie containing the current userId.
COPYRIGHT
Copyright (c) 2013 by OETIKER+PARTNER AG. All rights reserved.
AUTHOR
Tobi Oetiker <tobi@oetiker.ch>
HISTORY
2010-06-12 to 1.0 initial
2013-11-19 to 1.1 mojo port