1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
|
package VUser::Google::ProvisioningAPI::V2_0::UserEntry;
use warnings;
use strict;
use vars qw($AUTOLOAD);
use Carp;
our $VERSION = '0.2.0';
sub new {
my $object = shift;
my $class = ref($object) || $object;
#LP: changePasswordAtNextLogin
my ($user, $password, $family_name, $given_name, $quota, $email, $isSuspended, $changePasswordAtNextLogin, $hashFunctionName);
if (defined $isSuspended) {
$isSuspended = ($isSuspended)? '1' : '0';
}
#LP: changePasswordAtNextLogin
if (defined $changePasswordAtNextLogin) {
$changePasswordAtNextLogin = ($changePasswordAtNextLogin)? '1' : '0';
}
# This doesn't quite match the Java API but I don't really care right now.
# This is much easier. Perhaps, at some point in the future, this can
# be changed to match the Java API a little more.
my $self = {
'User' => $user,
'Password' => $password,
'isSuspended' => $isSuspended,
'FamilyName' => $family_name,
'GivenName' => $given_name,
'Email' => $email,
'Quota' => $quota,
#LP: changePasswordAtNextLogin
'changePasswordAtNextLogin' => $changePasswordAtNextLogin,
'hashFunctionName' => $hashFunctionName,
};
bless $self, $class;
return $self;
}
# Alias to match the Java API a little more
sub Suspended { $_[0]->isSuspended(@_); }
sub isSuspended {
my $self = shift;
my $suspended = shift;
if (defined $suspended) {
if (lc($suspended) eq 'false') {
$self->{'isSuspended'} = 0;
} elsif (not $suspended) {
$self->{'isSuspended'} = 0;
} else {
$self->{'isSuspended'} = 1;
}
}
return $self->{'isSuspended'};
}
#LP: changePasswordAtNextLogin
sub changePasswordAtNextLogin {
my $self = shift;
my $changePassword = shift;
if (defined $changePassword) {
if (lc($changePassword) eq 'false') {
$self->{'changePasswordAtNextLogin'} = 0;
} elsif (not $changePassword) {
$self->{'changePasswordAtNextLogin'} = 0;
} else {
$self->{'changePasswordAtNextLogin'} = 1;
}
}
return $self->{'changePasswordAtNextLogin'};
}
sub DESTROY { };
sub AUTOLOAD {
my $self = shift;
my $member = $AUTOLOAD;
$member =~ s/.*:://;
if (exists $self->{$member}) {
$self->{$member} = $_[0] if defined $_[0];
return $self->{$member};
} else {
croak "Unknown member: $member";
}
}
=pod
=head1 NAME
VUser::Google::ProvisioningAPI::V2_0::UserEntry - Google Provisioning API 2.0 User entry
=head1 SYNOPSIS
my $entry = VUser::Google::ProvisioningAPI::V2_0::UserEntry->new();
$entry->User('foo'); # set the user name to 'foo'
$entry->GivenName('Fred');
$entry->FamilyName('Oog');
=head1 ACCESSORS
=over
=item User
=item Password
=item isSuspended
=item FamilyName
=item GivenName
=item Email
=item Quota
=back
=head1 AUTHOR
Randy Smith, perlstalker at vuser dot org
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2007 by Randy Smith, perlstalker at vuser dot org
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.8.5 or,
at your option, any later version of Perl 5 you may have available.
=cut
1;
|