Provided by: libnet-duo-perl_1.01-1_all 

NAME
Net::Duo::Admin::User - Representation of a Duo user
SYNOPSIS
my $decoded_json = get_json();
my $user = Net::Duo::Admin::User->new($decoded_json);
say $user->realname;
REQUIREMENTS
Perl 5.14 or later and the modules HTTP::Request and HTTP::Response (part of HTTP::Message), JSON, LWP
(also known as libwww-perl), Perl6::Slurp, Sub::Install, and URI::Escape (part of URI), all of which are
available from CPAN.
DESCRIPTION
A Net::Duo::Admin::User object is a Perl representation of a Duo user as returned by the Duo Admin API,
usually via the users() method. It contains various information about the user, including their groups,
phones, and tokens.
CLASS METHODS
create(DUO, DATA)
Creates a new user in Duo and returns the resulting user as a new Net::Duo::Admin::User object. DUO
is the Net::Duo object that should be used to perform the creation. DATA is a reference to a hash
with the following keys:
email
The email address of this user. Optional.
notes
Notes about this user. Optional.
realname
The real name of this user. Optional.
status
The status of this user. See the "status()" method below for the possible values. Optional, and
will be set to "active" if no value is given.
username
The name of the user to create. This should be unique within this Duo account and can be used to
retrieve the user object again using the user() method of Net::Duo::Admin. Required.
new(DUO, DATA)
Creates a new Net::Duo::Admin::User object from a full data set. DUO is the Net::Duo object that
should be used for any further actions on this object. DATA should be the data structure returned by
the Duo REST API for a single user, after JSON decoding.
INSTANCE ACTION METHODS
add_phone(PHONE)
Associate the Net::Duo::Admin::Phone object PHONE with this user. Other phones associated with this
user will be left unchanged.
add_token(TOKEN)
Associate the Net::Duo::Admin::Token object TOKEN with this user. Other tokens associated with this
user will be left unchanged.
bypass_codes(DATA)
Requests bypass codes for the user, returning them as a reference to an array. DATA is a reference
to a hash of parameters chosen from the following keys, all of which are optional:
count
The number of bypass codes to request. At most 10 codes (the default if "codes" is not given)
can be created at a time. If this parameter is given, "codes" may not be given.
codes
A reference to an array of codes to set as bypass codes for this user. If this parameter is
given, "count" may not be given.
reuse_count
The number of times each code in the list may be reused. Defaults to 1. If set to 0, the codes
may be reused indefinitely.
valid_secs
The number of seconds for which these codes will be valid. If set to 0 (the default), the codes
will never expire.
commit()
Commit all changes made via the set_*() methods to Duo. Until this method is called, any changes
made via set_*() are only internal to the object and not reflected in Duo.
After commit(), the internal representation of the object will be refreshed to match the new data
returned by the Duo API for that object. Therefore, other fields of the object may change after
commit() if some other user has changed other, unrelated fields in the object.
It's best to think of this method as a synchronize operation: changed data is written back,
overwriting what's in Duo, and unchanged data may be overwritten by whatever is currently in Duo, if
it is different.
delete()
Delete this user from Duo. After successful completion of this call, the Net::Duo::Admin::User
object should be considered read-only, since no further changes to the object can be meaningfully
sent to Duo.
json()
Convert the data stored in the object to JSON and return the results. The resulting JSON should
match the JSON that one would get back from the Duo web service when retrieving the same object (plus
any changes made locally to the object via set_*() methods). This is primarily intended for
debugging dumps or for passing Duo objects to other systems via further JSON APIs.
remove_phone(PHONE)
Disassociate the Net::Duo::Admin::Phone object PHONE from this user. Other phones associated with
this user will be left unchanged.
remove_token(TOKEN)
Disassociate the Net::Duo::Admin::Token object TOKEN from this user. Other tokens associated with
this user will be left unchanged.
INSTANCE DATA METHODS
Some fields have set_*() methods. Those methods replace the value of the field in its entirety with the
new value passed in. This change is only made locally in the object until commit() is called.
email()
set_email(EMAIL)
The user's email address.
groups()
List of groups to which this user belongs, as Net::Duo::Admin::Group objects.
last_login()
The last time this user logged in, as a UNIX timestamp, or undef if the user has not logged in.
notes()
set_notes(NOTES)
Notes about this user.
phones()
List of phones this user can use, as Net::Duo::Admin::Phone objects.
realname()
set_realname(NAME)
The user's real name.
status()
set_status(STATUS)
One of the following values:
"active"
The user must complete secondary authentication.
"bypass"
The user will bypass secondary authentication after completing primary authentication.
"disabled"
The user will not be able to log in.
"locked out"
The user has been automatically locked out due to excessive authentication attempts.
tokens()
List of tokens this user can use, as Net::Duo::Admin::Token objects.
user_id()
The unique ID of this user as generated by Duo on user creation.
username()
set_username(USERNAME)
The username of this user.
AUTHOR
Russ Allbery <rra@cpan.org>
COPYRIGHT AND LICENSE
Copyright 2014 The Board of Trustees of the Leland Stanford Junior University
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial
portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
SEE ALSO
Net::Duo::Admin
Duo Admin API for users <https://www.duosecurity.com/docs/adminapi#users>
This module is part of the Net::Duo distribution. The current version of Net::Duo is available from
CPAN, or directly from its web site at <http://www.eyrie.org/~eagle/software/net-duo/>.
perl v5.20.2 2015-08-16 Net::Duo::Admin::User(3pm)