Convos::Core::User - A Convos user
DESCRIPTION
Convos::Core::User is a class used to model a user in Convos.
ATTRIBUTES
Convos::Core::User inherits all attributes from Mojo::Base and implements the following new ones.
core
$obj = $user->core;
Holds a Convos::Core object.
$str = $user->email;
Email address of user.
password
$str = $user->password;
Encrypted password. See "set_password" for how to change the password and "validate_password" for password authentication.
remote_address
$str = $user->remote_address;
$user = $user->remote_address('127.0.0.1');
Holds the last known remote address for the user.
roles
$array_ref = $user->roles;
Holds a list of roles that the user has. See "role" for changing this attribute.
uid
$str = $user->uid;
Returns the UID for this user.
unread
$int = $user->unread;
$user = $user->unread(4);
Number of unread notifications for user.
uri
$path = $user->uri;
Holds a Mojo::Path object, with the URI to where this object should be stored.
METHODS
Convos::Core::User inherits all methods from Mojo::Base and implements the following new ones.
connection
$connection = $user->connection(\%attrs);
Returns a new Convos::Core::Connection object or updates an existing object.
connections
$objs = $user->connections;
Returns an array-ref of of Convos::Core::Connection objects.
get_connection
$connection = $user->get_connection($id);
$connection = $user->get_connection(\%attrs);
Returns a Convos::Core::Connection object or undef.
get_p
my $p = $user->get_p(\%args)->then(sub { my $json = shift });
Used to retrive information about the current user.
id
$str = $user->id;
$str = $class->id(\%attr);
Returns a unique identifier for a user.
load_connections_p
$p = $user->load_connections_p;
Used to load all connections for a user.
new
$user = Convos::Core::User->new(\%attributes);
Used to construct a new object.
notifications_p
$p = $user->notifications_p($query)->then(sub { my $notifications = shift });
Used to retrieve a list of notifications. See also "notifications" in Convos::Core::Backend.
remove_connection_p
$p = $user->remove_connection_p($connection)->then(sub { my $connection = shift });
$p = $user->remove_connection_p($id)->then(sub { my $connection = shift });
Will remove a connection created by "connection". Removing a connection that does not exist is perfectly valid, and will not result in a rejected promise.
registered
$mojo_date = $user->registered;
Holds a Mojo::Date object for when the user was registered.
role
$bool = $user->role(has => "admin");
$user = $user->role(give => "admin");
$user = $user->role(take => "admin");
Used to modify "roles" for a given user.
save_p
$p = $user->save_p;
Will save "ATTRIBUTES" to persistent storage. See "save_object" in Convos::Core::Backend for details.
set_password
$user = $user->set_password($plain);
Will set "password" to a crypted version of $plain
.
validate_password
$bool = $user->validate_password($plain);
Will verify $plain
text password against "password".