- CLASS METHODS
- INSTANCE ACTION METHODS
- INSTANCE DATA METHODS
- COPYRIGHT AND LICENSE
- SEE ALSO
Net::Duo::Admin::User - Representation of a Duo user
my $decoded_json = get_json(); my $user = Net::Duo::Admin::User->new($decoded_json); say $user->realname;
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.
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.
- 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:
The email address of this user. Optional.
Notes about this user. Optional.
The real name of this user. Optional.
The status of this user. See the "status()" method below for the possible values. Optional, and will be set to
activeif no value is given.
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.
Associate the Net::Duo::Admin::Phone object PHONE with this user. Other phones associated with this user will be left unchanged.
Associate the Net::Duo::Admin::Token object TOKEN with this user. Other tokens associated with this user will be left unchanged.
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:
The number of bypass codes to request. At most 10 codes (the default if
codesis not given) can be created at a time. If this parameter is given,
codesmay not be given.
A reference to an array of codes to set as bypass codes for this user. If this parameter is given,
countmay not be given.
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.
The number of seconds for which these codes will be valid. If set to 0 (the default), the codes will never expire.
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 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.
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.
Disassociate the Net::Duo::Admin::Phone object PHONE from this user. Other phones associated with this user will be left unchanged.
Disassociate the Net::Duo::Admin::Token object TOKEN from this user. Other tokens associated with this user will be left unchanged.
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.
The user's email address.
List of groups to which this user belongs, as Net::Duo::Admin::Group objects.
The last time this user logged in, as a UNIX timestamp, or undef if the user has not logged in.
Notes about this user.
List of phones this user can use, as Net::Duo::Admin::Phone objects.
The user's real name.
One of the following values:
List of tokens this user can use, as Net::Duo::Admin::Token objects.
The unique ID of this user as generated by Duo on user creation.
The username of this user.
Russ Allbery <firstname.lastname@example.org>
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.
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 https://www.eyrie.org/~eagle/software/net-duo/.