Commit ae3dcb4c authored by Côme Chilliet's avatar Côme Chilliet

feat(user-reminder) Add support for supannRessourceEtatDate for user-reminder

This considers that the end date is an expiration date if the current
 state is A for COMPTE.

issue #5744
parent 3a133bb9
......@@ -48,12 +48,13 @@ $config->{'fd_rdn'} = 'ou=fusiondirectory';
my $verbose = 0;
my $posix = 1;
my $ppolicy = 1;
my $supann = 0;
sub print_usage
{
my ($help) = @_;
print "Usage : argonaut-user-reminder [--help] [--verbose] [--posix|--ppolicy|--both (default)]\n";
print "Usage : argonaut-user-reminder [--help] [--verbose] [--posix|--ppolicy|--both (default)|--supann]\n";
if ($help) {
print << "EOF";
......@@ -61,7 +62,8 @@ sub print_usage
--verbose : be verbose
--posix : check POSIX account expiration
--ppolicy : check ppolicy password expiration
--both : check both (default)
--both : check both POSIX and ppolicy (default)
--supann : check supannRessourceEtatDate
EOF
exit(0);
} else {
......@@ -260,6 +262,27 @@ sub check_expired_users
}
}
}
if ($supann) {
# SupAnn expiration
# Consider supannRessourceEtatDate end date to be an expiration date if state is A
my $mesg = $ldap->search(
base => $config->{'ldap_base'},
filter => '(&(objectClass=person)(supannRessourceEtatDate={COMPTE}A:*))',
scope => 'subtree'
);
die_on_ldap_errors($mesg);
foreach my $entry ($mesg->entries()) {
my $cn = $entry->get_value('cn');
my ($labelstate, $substate, $start, $end) = split(':', $entry->get_value('supannRessourceEtatDate'));
if ($end < $now) {
print "$cn has an invalid supannRessourceEtatDate value\n" if $verbose;
} elsif ($end <= $next_alert_date) {
alert_user_if_needed($ldap,$entry,$now,0);
}
}
}
}
sub get_mail_from_entry
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment