38 lines
646 B
Perl
38 lines
646 B
Perl
|
#! /usr/bin/env perl
|
||
|
|
||
|
use v5.10.1;
|
||
|
use strict;
|
||
|
use warnings;
|
||
|
use Pod::Usage;
|
||
|
|
||
|
use lib "../../";
|
||
|
|
||
|
use ACU::Log;
|
||
|
use ACU::LDAP;
|
||
|
|
||
|
sub get_students()
|
||
|
{
|
||
|
my $ldap = LDAP::ldap_connect();
|
||
|
|
||
|
my $year = LDAP::get_year($ldap);
|
||
|
|
||
|
return LDAP::search_dns($ldap, "ou=$year,ou=users", "objectClass=epitaAccount", "cn", "uid", "uidNumber");
|
||
|
}
|
||
|
|
||
|
if ($#ARGV == -1) {
|
||
|
log(USAGE, "$0 format");
|
||
|
say "format can be csv"
|
||
|
}
|
||
|
elsif ($ARGV[0] eq "csv")
|
||
|
{
|
||
|
for my $student (get_students)
|
||
|
{
|
||
|
print $student->get_value("cn");
|
||
|
print ",";
|
||
|
print $student->get_value("uid");
|
||
|
print ",";
|
||
|
print $student->get_value("uidNumber");
|
||
|
say ",Present";
|
||
|
}
|
||
|
}
|