Last change
on this file since 207 was
207,
checked in by nanardon, 15 years ago
|
- finish set_password in Ad
|
-
Property svn:executable set to
*
|
File size:
681 bytes
|
Line | |
---|
1 | #!/usr/bin/perl |
---|
2 | |
---|
3 | use strict; |
---|
4 | use warnings; |
---|
5 | use LATMOS::Accounts; |
---|
6 | use Getopt::Long; |
---|
7 | use Pod::Usage; |
---|
8 | |
---|
9 | GetOptions( |
---|
10 | 'c|config=s' => \my $config, |
---|
11 | 'b|base=s' => \my $base, |
---|
12 | 'help' => sub { pod2usage(0) }, |
---|
13 | ) or pod2usage(); |
---|
14 | |
---|
15 | my $otype = 'user'; |
---|
16 | |
---|
17 | my $LA = LATMOS::Accounts->new($config); |
---|
18 | my $labase = $base ? $LA->base($base) : $LA->default_base; |
---|
19 | $labase && $labase->load or die "Cannot load base"; |
---|
20 | |
---|
21 | my $obj = $labase->get_object($otype, $ARGV[0]) or do { |
---|
22 | die "Object $otype $ARGV[0] not found\n"; |
---|
23 | }; |
---|
24 | if ($obj->set_password($ARGV[1])) { |
---|
25 | print "Password succefully changed\n"; |
---|
26 | exit 0; |
---|
27 | } else { |
---|
28 | warn "Error when trying to change password\n"; |
---|
29 | exit 1; |
---|
30 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.