Apache-Sling
view release on metacpan or search on metacpan
lib/Apache/Sling/LDAPSynch.pm view on Meta::CPAN
#{{{sub synch_full_since
sub synch_full_since {
my ( $class, $ldap_attrs, $sling_attrs, $synch_since ) = @_;
my $search = q{(modifytimestamp>=} . $synch_since . q{)};
my $search_result = $class->ldap_search( $search, $ldap_attrs );
croak q(Function not yet fully supported!);
# return 1;
}
#}}}
#{{{sub synch_listed
sub synch_listed {
my ( $class, $ldap_attrs, $sling_attrs ) = @_;
my $search = q{(} . $class->{'Filter'} . q{=*)};
my $search_result = $class->ldap_search( $search, $ldap_attrs );
croak q(Function not yet fully supported!);
# return 1;
}
#}}}
#{{{sub synch_listed_since
sub synch_listed_since {
my ( $class, $ldap_attrs, $sling_attrs, $synch_since ) = @_;
my $search = q{(} . $class->{'Filter'} . q{=*)};
my $search_result = $class->ldap_search( $search, $ldap_attrs );
croak q(Function not yet fully supported!);
# return 1;
}
#}}}
#{{{ sub command_line
sub command_line {
my ( $ldap_synch, @ARGV ) = @_;
my $sling = Apache::Sling->new;
my $config = $ldap_synch->config( $sling, @ARGV );
return $ldap_synch->run( $sling, $config );
}
#}}}
#{{{sub config
sub config {
my ( $ldap_synch, $sling, @ARGV ) = @_;
my $ldap_synch_config = $ldap_synch->config_hash( $sling, @ARGV );
GetOptions(
$ldap_synch_config, 'auth=s',
'help|?', 'log|L=s',
'man|M', 'pass|p=s',
'threads|t=s', 'url|U=s',
'user|u=s', 'verbose|v+',
'download-user-list', 'ldap-attributes|a=s',
'ldap-base|b=s', 'ldap-dn|d=s',
'ldap-filter|f=s', 'ldap-host|h=s',
'ldap-pass|P=s', 'attributes|A=s',
'synch-full|s', 'synch-full-since|S=s',
'synch-listed|l', 'synch-listed-since',
'upload-user-list'
) or $ldap_synch->help();
return $ldap_synch_config;
}
#}}}
#{{{sub config_hash
sub config_hash {
my ( $ldap_synch, $sling, @ARGV ) = @_;
my $attributes;
my $download_user_list;
my $flag_disabled;
my $ldap_attributes;
my $ldap_base;
my $ldap_dn;
my $ldap_filter;
my $ldap_host;
my $ldap_pass;
my $synch_full;
my $synch_full_since;
my $synch_listed;
my $synch_listed_since;
my $upload_user_list;
my %ldap_synch_config = (
'auth' => \$sling->{'Auth'},
'help' => \$sling->{'Help'},
'log' => \$sling->{'Log'},
'man' => \$sling->{'Man'},
'pass' => \$sling->{'Pass'},
'threads' => \$sling->{'Threads'},
'url' => \$sling->{'URL'},
'user' => \$sling->{'User'},
'verbose' => \$sling->{'Verbose'},
'attributes' => $attributes,
'download-user-list' => $download_user_list,
'flag-disabled' => $flag_disabled,
'ldap-attributes' => $ldap_attributes,
'ldap-base' => $ldap_base,
'ldap-dn' => $ldap_dn,
'ldap-filter' => $ldap_filter,
'ldap-host' => $ldap_host,
'ldap-pass' => $ldap_pass,
'synch-full' => $synch_full,
'synch-full-since' => $synch_full_since,
'synch-listed' => $synch_listed,
'synch-listed-since' => $synch_listed_since,
'upload-user-list' => $upload_user_list
);
return \%ldap_synch_config;
}
#}}}
#{{{ sub help
sub help {
print <<"EOF";
Usage: perl $0 [-OPTIONS [-MORE_OPTIONS]] [--] [PROGRAM_ARG1 ...]
The following options are accepted:
--attributes or -a (attribs) - Comma separated list of attributes.
--auth (type) - Specify auth type. If ommitted, default is used.
--download-user-list (userList) - Download user list to file userList
--flag-disabled or -f - property to denote user should be disabled.
--help or -? - View the script synopsis and options.
--ldap-attributes or -A (attribs) - Specify ldap attributes to be updated.
--ldap-base or -B (ldapBase) - Specify ldap base to synchronize users from.
--ldap-dn or -D (ldapDN) - Specify ldap DN for authentication.
--ldap-filter or -F (filter) - Specify ldap attribute to search for users with.
--ldap-host or -H (host) - Specify ldap host to synchronize from.
--ldap-pass or -P (pass) - Specify ldap pass for authentication.
--log or -L (log) - Log script output to specified log file.
--man or -M - View the full script documentation.
--pass or -p (password) - Password of user performing actions.
--synch-full or -s - Perform a full synchronization from ldap to sling.
--synch-full-since or -S (since) - Perform a full synchronization from ldap to sling using changes since specified time.
--synch-listed or -l - Perform a sychronization of listed users from ldap to sling.
--synch-listed-since (since) - Perform a sychronization of listed users from ldap to sling using changes since specified time.
--upload-user-list (userList) - Upload user list specified by file userList.
--url or -U (URL) - URL for system being tested against.
--user or -u (username) - Name of user to perform any actions as.
--verbose or -v or -vv or -vvv - Increase verbosity of output.
Options may be merged together. -- stops processing of options.
Space is not required between options and their arguments.
For full details run: perl $0 --man
EOF
return 1;
( run in 0.810 second using v1.01-cache-2.11-cpan-39bf76dae61 )