#!/usr/bin/perl -w
# This script (sophomorix-test-workflow) is maintained by Rüdiger Beck
# It is Free Software (License GPLv3)
# If you find errors, contact the author
# jeffbeck@web.de  or  jeffbeck@linuxmuster.net

# modules
use strict;
use Getopt::Long;
Getopt::Long::Configure ("bundling");
use Sophomorix::SophomorixBase qw(
                                 print_line
                                 print_title
                                 check_options
                                 );
use Sophomorix::SophomorixSambaAD qw(
                                 AD_bind_admin
                                 AD_unbind_admin
                                 AD_dns_get
                                 AD_object_search
                                    );
use Sophomorix::SophomorixTest qw(
                                 AD_object_nonexist
                                 AD_dn_nonexist
                                 AD_test_object
                                 directory_tree_test
                                 start_fs_test
                                 end_fs_test
                                 run_command
                                 AD_test_session_count
                                 ACL_test
                                 file_test_lines
                                 AD_user_timeupdate
                                 AD_get_samaccountname
                                 );

$Conf::log_level=1;
my $add_check=0;
my $modify_1_check=0;
my $modify_2_check=0;
my $modify_3_check=0;
my $modify_4_check=0;
my $modify_5_check=0;
my $modify_10_check=0;
my $kill_user_check=0;
my $kill_adminclasses_check=0;
my $kill_projects_check=0;

my $add_do=0;
my $modify_1_do=0;
my $modify_2_do=0;
my $modify_3_do=0;
my $modify_4_do=0;
my $modify_5_do=0;
my $modify_10_do=0;
my $kill_user_do=0;
my $kill_adminclasses_do=0;
my $kill_projects_do=0;

my $modify_10_test=0;
my $kill_user_test=0;
my $kill_adminclasses_test=0;
my $kill_projects_test=0;

my $full=0;
my $help=0;
my $all_options="";
my $json=0;
my $ntacl=1;
my $nontacl=0;
my %fs_test_result=();

my $testopt=GetOptions(
           "help|h" => \$help,
           "verbose|v+" => \$Conf::log_level,
           "json|j+" => \$json,
           "nontacl|n" => \$nontacl,
           "add-check" => \$add_check,
           "add-do" => \$add_do,
           "modify-1-check" => \$modify_1_check,
           "modify-2-check" => \$modify_2_check,
           "modify-3-check" => \$modify_3_check,
           "modify-4-check" => \$modify_4_check,
           "modify-5-check" => \$modify_5_check,
           "modify-10-check" => \$modify_10_check,
           "modify-1-do" => \$modify_1_do,
           "modify-2-do" => \$modify_2_do,
           "modify-3-do" => \$modify_3_do,
           "modify-4-do" => \$modify_4_do,
           "modify-5-do" => \$modify_5_do,
           "modify-10-do" => \$modify_10_do,
           "modify-10-test" => \$modify_10_test,
           "kill-user-check" => \$kill_user_check,
           "kill-adminclasses-check" => \$kill_adminclasses_check,
           "kill-projects-check" => \$kill_projects_check,
           "kill-user-do" => \$kill_user_do,
           "kill-adminclasses-do" => \$kill_adminclasses_do,
           "kill-projects-do" => \$kill_projects_do,
           "kill-user-test" => \$kill_user_test,
           "kill-adminclasses-test" => \$kill_adminclasses_test,
           "kill-projects-test" => \$kill_projects_test,
           "full|f" => \$full,
          );

# Prüfen, ob Optionen erkannt wurden, sonst Abbruch
&check_options($testopt);

if ($nontacl==1){
    $ntacl=0;
}

if ($Conf::log_level==1){
    $all_options="";
} elsif ($Conf::log_level==2){
    $all_options="-v";
} elsif ($Conf::log_level==3){
    $all_options="-vv";
}

if ($json==0){
    # nothing to do
} elsif ($json==1){
    $all_options=$all_options." -j";
} elsif ($json==2){
    $all_options=$all_options." -jj";
} elsif ($json==3){
    $all_options=$all_options." -jjj";
} 

my ($ldap,$root_dse) = &AD_bind_admin();
my $root_dns=&AD_dns_get($root_dse);

# --help
if ($help==1) {
   # Scriptname ermitteln
   my @list = split(/\//,$0);
   my $scriptname = pop @list;
   # Befehlsbeschreibung
   print('
sophomorix-test-workflow tests sophomorix-add,sophomorix-update and sophomorix-kill.

Created users or groups might clash with users or groups already added.
It is recommended that sophomorix-test-test-workflow is only run on test servers 
without existing users and groups.

Options
  -h  / --help

Full automated test:

  -f, --full 
   full test (adding, modifying, killing users)

Step by step Test:

  Adding users:
      sophomorix-test-workflow --add-check
      sophomorix-test-workflow --add-do

  Work with the users:
      sophomorix-test-workflow --modify-1-check
      sophomorix-test-workflow --modify-1-do

      sophomorix-test-workflow --modify-2-check
      sophomorix-test-workflow --modify-2-do

      sophomorix-test-workflow --modify-3-check
      sophomorix-test-workflow --modify-3-do

      sophomorix-test-workflow --modify-4-check
      sophomorix-test-workflow --modify-4-do

      sophomorix-test-workflow --modify-5-check
      sophomorix-test-workflow --modify-5-do

  Test project stuff
      sophomorix-test-workflow --modify-10-do

  Kill the added users, adminclasses and projects:
      sophomorix-test-workflow --kill-user-check
      sophomorix-test-workflow --kill-user-do
      sophomorix-test-workflow --kill-user-test

      sophomorix-test-workflow --kill-adminclasses-check
      sophomorix-test-workflow --kill-adminclasses-do
      sophomorix-test-workflow --kill-adminclasses-test

      sophomorix-test-workflow --kill-projects-check
      sophomorix-test-workflow --kill-projects-do
      sophomorix-test-workflow --kill-projects-test

');
   print "\n";
   exit;
}




############################################################
# Check preliminaries
############################################################

&run_command("mkdir -p /var/lib/sophomorix/check-result");


# --full
if ($full==1){
    $add_check=1;
    $add_do=1;
    $modify_1_check=1;
    $modify_1_do=1;
    $modify_2_check=1;
    $modify_2_do=1;
    $modify_3_check=1;
    $modify_3_do=1;
    $modify_4_check=1;
    $modify_4_do=1;
    $modify_5_check=1;
    $modify_5_do=1;
    $modify_10_check=1;
    $modify_10_do=1;
    $modify_10_test=1;
    $kill_user_check=1;
    $kill_user_do=1;
    $kill_user_test=1;
    $kill_adminclasses_check=1;
    $kill_adminclasses_do=1;
    $kill_adminclasses_test=1;
    $kill_projects_check=1;
    $kill_projects_do=1;
    $kill_projects_test=1;
}


############################################################
# Adding users --add
############################################################
if ($add_check==1){
    my $command_add="sophomorix-check $all_options ".
                "--injectline \"bsz.teachers.csv:teachers;Kopernikus;Nikolaus;19.02.1982;koperni99\" ".
                "--injectline \"bsz.teachers.csv:teachers;Darwing;Charles;12.02.2009;darwi99\" ".
                "--injectline \"bsz.students.csv:m3KK3T;Mondel;Gregor;01.02.2000;\" ".
                "--injectline \"bsz.students.csv:m3KK3T;Wallace;Alfred Rusel;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99\" ".
                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".
                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".
                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".
                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ".
                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ".
                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ".
                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ";
    &run_command($command_add);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",12);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);

}
############################################################
if ($add_do==1){
    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");

    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mondel",
                                givenName=>"Gregor",
                                birthdate=>"01.02.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Rusel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mondel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk3t\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk3t/".$mendelgr,
                   sn=>"Mondel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk3t",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mondel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.02.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk3t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Rusel Wallace",
                   givenName=>"Alfred Rusel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk3t\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk3t/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk3t",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Rusel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk3t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    my $dn_gunnarar="CN=".$gunnarar.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    my $dn_sigurdra="CN=".$sigurdra.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy
    my $dn_sigurdgy="CN=".$sigurdgy.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdgy,
                   #####
                   displayName=>"Gylfi Þór Sigurðsson",
                   givenName=>"Gylfi Þór",
                   name=>$sigurdgy,
                   sAMAccountname=>$sigurdgy,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdgy,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdgy,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdgy."@".$root_dns,
                   mail => $sigurdgy."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gylfi Thor",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "G. Þ.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "08.09.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users class
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$halldoha."|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $halldoha."|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$mendelgr."|".$wallacal,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => $mendelgr."|".$wallacal,
                  });
    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "7a|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|global-students",
                  });

    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1982",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwing",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/darwi99",
                   sn=>"Darwing",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwing",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=skula99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bjarna99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Theódór Elmar Bjarnason",
                   givenName=>"Theódór Elmar",
                   name=>"bjarna99",
                   sAMAccountname=>"bjarna99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\bjarna99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/bjarna99",
                   sn=>"Bjarnason",
                   userPrincipalName => "bjarna99@".$root_dns,
                   mail => "bjarna99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Theodor Elmar",
                   sophomorixSurnameASCII  => "Bjarnason",
                   sophomorixFirstnameInitial => "T. E.",
                   sophomorixSurnameInitial  => "B.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "04.03.1987",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"rukri99|olinst99|skula99|bjarna99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => "rukri99|olinst99|skula99|bjarna99|global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"koperni99|darwi99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "koperni99|darwi99|global-teachers",
                  });
}





############################################################
# --modify-1-check --modify-1-do
############################################################
if ($modify_1_check==1){
    # name/birthday correction koperni99,darwi99,$mendelgr,$wallacal
    my $command_modify_1="sophomorix-check --dump-AD $all_options ".
                "--injectline \"bsz.teachers.csv:teachers;Kopernikus;Nikolaus;19.02.1973;koperni99\" ".
                "--injectline \"bsz.teachers.csv:teachers;Darwin;Charles;12.02.2009;darwi99\" ".
                "--injectline \"bsz.students.csv:m3KK3T;Mendel;Gregor;01.01.2000;\" ".
                "--injectline \"bsz.students.csv:m3KK3T;Wallace;Alfred Russel;01.01.2000;\" ";
#                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99\" ".   # removed
#                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".            # removed
#                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".           # removed
#                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".     # removed
#                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ".                    # removed
#                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ".                           # removed
#                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ";                         # removed
#                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ".""                    # removed

    &run_command($command_modify_1);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",12);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}
############################################################
if ($modify_1_do==1){
    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");

    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mendel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk3t\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk3t/".$mendelgr,
                   sn=>"Mendel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk3t",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mendel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk3t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Russel Wallace",
                   givenName=>"Alfred Russel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk3t\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk3t/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk3t",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Russel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk3t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    my $dn_gunnarar="CN=".$gunnarar.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    my $dn_sigurdra="CN=".$sigurdra.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy
    my $dn_sigurdgy="CN=".$sigurdgy.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdgy,
                   #####
                   displayName=>"Gylfi Þór Sigurðsson",
                   givenName=>"Gylfi Þór",
                   name=>$sigurdgy,
                   sAMAccountname=>$sigurdgy,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdgy,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdgy,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdgy."@".$root_dns,
                   mail => $sigurdgy."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gylfi Thor",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "G. Þ.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "08.09.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users old class 7a
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "",
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"olinst99|rukri99|skula99|bjarna99|".$halldoha."|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "olinst99|rukri99|skula99|bjarna99|".$halldoha."|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$mendelgr."|".$wallacal,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => $mendelgr."|".$wallacal,
                  });
    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "7a|attic|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|global-students",
                  });


    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwin",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/darwi99",
                   sn=>"Darwin",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwin",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=skula99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bjarna99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Theódór Elmar Bjarnason",
                   givenName=>"Theódór Elmar",
                   name=>"bjarna99",
                   sAMAccountname=>"bjarna99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\bjarna99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/bjarna99",
                   sn=>"Bjarnason",
                   userPrincipalName => "bjarna99@".$root_dns,
                   mail => "bjarna99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Theodor Elmar",
                   sophomorixSurnameASCII  => "Bjarnason",
                   sophomorixFirstnameInitial => "T. E.",
                   sophomorixSurnameInitial  => "B.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "04.03.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "exists",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "T",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"koperni99|darwi99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "koperni99|darwi99|global-teachers",
                  });
}





############################################################
# --modify-2-check  --modify-2-do
############################################################
if ($modify_2_check==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    my $dn_gunnarar="CN=".$gunnarar.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_gunnarar,"20170101000001.0Z","---");
    my $dn_sigurdra="CN=".$sigurdra.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_sigurdra,"20170101000002.0Z","---");
    my $dn_sigurdgy="CN=".$sigurdgy.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_sigurdgy,"20170101000003.0Z","---");

    my $dn_rukri99="CN=rukri99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_rukri99,"20170101000004.0Z","---");
    my $dn_skula99="CN=skula99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_skula99,"20170101000005.0Z","---");
    my $dn_bjarna99="CN=bjarna99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_bjarna99,"20170101000006.0Z","---");

    # moving 
    #  koperni99
    #  darwi99
    #  $mendelgr m3KK3T -> m3KK4T
    #  $wallacal
    my $command_modify_2="sophomorix-check $all_options ".
                "--injectline \"bsz.teachers.csv:teachers;Kopernikus;Nikolaus;19.02.1973;koperni99\" ".
                "--injectline \"bsz.students.csv:m3KK4T;Darwin;Charles;12.02.2009;\" ".
                "--injectline \"bsz.teachers.csv:teachers;Mendel;Gregor;01.01.2000;\" ".
                "--injectline \"bsz.students.csv:m3KK4T;Wallace;Alfred Russel;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99\" ".    # back
#                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".            # removed
#                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".           # removed
#                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".     # removed
                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ";                      # back
#                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ".                           # removed
#                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ";                         # removed
#                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ".""                    # removed

    &run_command($command_modify_2);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",11);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",1);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}
############################################################
if ($modify_2_do==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    my $dn_gunnarar="CN=".$gunnarar.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_sigurdra="CN=".$sigurdra.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_sigurdgy="CN=".$sigurdgy.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;

    my $dn_rukri99="CN=rukri99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_skula99="CN=skula99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_bjarna99="CN=bjarna99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse;

    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mendel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/".$mendelgr,
                   sn=>"Mendel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "bsz-m3kk3t",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mendel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Russel Wallace",
                   givenName=>"Alfred Russel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk4t\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk4t/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk4t",
                   sophomorixExitAdminClass => "bsz-m3kk3t",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Russel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk4t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });
    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    # my $dn_gunnarar="CN=".$gunnarar.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000001.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    # my $dn_sigurdra="CN=".$sigurdra.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000002.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy
    #my $dn_sigurdgy="CN=".$sigurdgy.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdgy,
                   #####
                   displayName=>"Gylfi Þór Sigurðsson",
                   givenName=>"Gylfi Þór",
                   name=>$sigurdgy,
                   sAMAccountname=>$sigurdgy,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdgy,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdgy,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdgy."@".$root_dns,
                   mail => $sigurdgy."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gylfi Thor",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "G. Þ.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "08.09.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000003.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users class
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$halldoha,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $halldoha,
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"rukri99|skula99|bjarna99|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "rukri99|skula99|bjarna99|".$gunnarar."|".$sigurdra."|".$sigurdgy,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk4t,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk4t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk4t@"."adminclass.net",
                   description=>"bsz-m3kk4t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"darwi99|".$wallacal,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "darwi99|".$wallacal,
                  });
    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "7a|attic|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|bsz-m3kk4t|global-students",
                  });


    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\teachers\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/teachers/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@"."teacher.bsz.de",
                   sophomorixAdminClass => "bsz-teachers",
                   sophomorixExitAdminClass => "unknown",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-teachers|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwin",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\bsz\\students\\m3kk4t\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/bsz/students/m3kk4t/darwi99",
                   sn=>"Darwin",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@"."student.bsz.de",
                   sophomorixAdminClass => "bsz-m3kk4t",
                   sophomorixExitAdminClass => "bsz-teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwin",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "bsz",
                   sophomorixSchoolname => "bsz",
                   sophomorixAdminFile => "bsz.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "bsz-m3kk4t|bsz-wifi|bsz-internet|bsz-webfilter|bsz-intranet|bsz-printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000004.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=skula99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000005.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bjarna99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Theódór Elmar Bjarnason",
                   givenName=>"Theódór Elmar",
                   name=>"bjarna99",
                   sAMAccountname=>"bjarna99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\bjarna99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/bjarna99",
                   sn=>"Bjarnason",
                   userPrincipalName => "bjarna99@".$root_dns,
                   mail => "bjarna99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Theodor Elmar",
                   sophomorixSurnameASCII  => "Bjarnason",
                   sophomorixFirstnameInitial => "T. E.",
                   sophomorixSurnameInitial  => "B.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "04.03.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20170101000006.0Z",
                   sophomorixDeactivationDate => "exists",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "D",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"olinst99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => "olinst99|global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>$mendelgr."|koperni99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => $mendelgr."|koperni99|global-teachers",
                  });
}





############################################################
# --modify-3-check --modify-3-do
############################################################
if ($modify_3_check==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    my $dn_sigurdra="CN=".$sigurdra.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_sigurdra,"20160101000002.0Z","20170101000002.0Z");
    my $dn_sigurdgy="CN=".$sigurdgy.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_sigurdgy,"20160101000003.0Z","20170101000003.0Z");

    my $dn_skula99="CN=skula99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_skula99,"20160101000005.0Z","20170101000005.0Z");
    my $dn_bjarna99="CN=bjarna99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_user_timeupdate($ldap,$root_dse,$dn_bjarna99,"20160101000006.0Z","20170101000006.0Z");

    my $command_modify_3="sophomorix-check $all_options ".
                "--injectline \"uni.teachers.csv:teachers;Kopernikus;Nikolaus;19.02.1973;koperni99\" ".
                "--injectline \"students.csv:9b;Darwin;Charles;12.02.2009;\" ".
                "--injectline \"teachers.csv:teachers;Mendel;Gregor;01.01.2000;\" ".
                "--injectline \"uni.students.csv:12b;Wallace;Alfred Russel;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99\" ".
                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".             # back
#                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".           # removed
#                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".     # removed
                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ".
                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ";                            # back
#                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ";                         # removed
#                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ".""                    # removed

    &run_command($command_modify_3);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",10);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",4);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",2);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}
############################################################
if ($modify_3_do==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    my $dn_sigurdgy="CN=".$sigurdgy.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_sigurdra="CN=".$sigurdra.",OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_skula99="CN=skula99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    my $dn_bjarna99="CN=bjarna99,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;

    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    # do not kill the users now (first test if they have status R)

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mendel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/".$mendelgr,
                   sn=>"Mendel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "bsz-teachers",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mendel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Russel Wallace",
                   givenName=>"Alfred Russel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\students\\12b\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/uni/students/12b/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@".$root_dns,
                   sophomorixAdminClass => "uni-12b",
                   sophomorixExitAdminClass => "bsz-m3kk4t",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Russel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-12b|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });
    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    my $dn_gunnarar="CN=".$gunnarar.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    # my $dn_sigurdra="CN=".$sigurdra.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20160101000002.0Z",
                   sophomorixDeactivationDate => "20170101000002.0Z",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "R",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy
    #my $dn_sigurdgy="CN=".$sigurdgy.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdgy,
                   #####
                   displayName=>"Gylfi Þór Sigurðsson",
                   givenName=>"Gylfi Þór",
                   name=>$sigurdgy,
                   sAMAccountname=>$sigurdgy,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\".$sigurdgy,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/".$sigurdgy,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdgy."@".$root_dns,
                   mail => $sigurdgy."@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "7a",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gylfi Thor",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "G. Þ.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "08.09.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20160101000003.0Z",
                   sophomorixDeactivationDate => "20170101000003.0Z",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "R",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users class
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$halldoha."|".$gunnarar,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $halldoha."|".$gunnarar,
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"skula99|bjarna99|".$sigurdra."|".$sigurdgy,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "skula99|bjarna99|".$sigurdra."|".$sigurdgy,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk4t,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk4t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk4t@"."adminclass.net",
                   description=>"bsz-m3kk4t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-12b,OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-12b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "uni-12b@".$root_dns,
                   description=>"uni-12b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"uni:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$wallacal,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "uni-students",
                   member => $wallacal,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=9b,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"9b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "9b@".$root_dns,
                   description=>"9b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"darwi99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "darwi99",
                  });

    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "attic|7a|9b|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|bsz-m3kk4t|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-students,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "uni-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-students",
                   member => "uni-12b|global-students",
                  });


    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\teachers\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/uni/teachers/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@".$root_dns,
                   sophomorixAdminClass => "uni-teachers",
                   sophomorixExitAdminClass => "bsz-teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-teachers|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwin",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\9b\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/9b/darwi99",
                   sn=>"Darwin",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@".$root_dns,
                   sophomorixAdminClass => "9b",
                   sophomorixExitAdminClass => "bsz-m3kk4t",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwin",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "9b|wifi|internet|webfilter|intranet|printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_skula99,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20160101000005.0Z",
                   sophomorixDeactivationDate => "20170101000005.0Z",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "R",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99
    &AD_test_object({ldap=>$ldap,
#                   dn=>"CN=bjarna99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   dn=>$dn_bjarna99,
                   #####
                   displayName=>"Theódór Elmar Bjarnason",
                   givenName=>"Theódór Elmar",
                   name=>"bjarna99",
                   sAMAccountname=>"bjarna99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\attic\\bjarna99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/attic/bjarna99",
                   sn=>"Bjarnason",
                   userPrincipalName => "bjarna99@".$root_dns,
                   mail => "bjarna99@".$root_dns,
                   sophomorixAdminClass => "attic",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Theodor Elmar",
                   sophomorixSurnameASCII  => "Bjarnason",
                   sophomorixFirstnameInitial => "T. E.",
                   sophomorixSurnameInitial  => "B.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "04.03.1987",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "20160101000006.0Z",
                   sophomorixDeactivationDate => "20170101000006.0Z",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "R",
                   accountExpires => "0",
                   userAccountControl => "66050",
                   memberOf => "attic|wifi|internet|webfilter|intranet|printing",
                  });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>$mendelgr."|rukri99|olinst99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => $mendelgr."|rukri99|olinst99|global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>"koperni99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => "koperni99|global-teachers",
                  });
}





############################################################
# --modify-4-check --modify-4-do
############################################################
if ($modify_4_check==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    my $command_modify_4="sophomorix-check $all_options ".
                "--injectline \"uni.teachers.csv:teachers;Kopernikus;Nikolaus;19.02.1973;koperni99;\" ".
                "--injectline \"teachers.csv:teachers;Darwin;Charles;12.02.2009\" ".
                "--injectline \"students.csv:9b;Mendel;Gregor;01.01.2000;\" ".
                "--injectline \"uni.students.csv:12b;Wallace;Alfred Russel;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99;\" ".
                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".             # back
                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".            # back
#                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".     # removed
                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ".
                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ".                            # back
                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ";                          # back
#                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ".""                    # removed
    ############################################################
    # kill the users, that can be killed and test again
    ############################################################
    &run_command($command_modify_4);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",4);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",2);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",6);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}
############################################################
if ($modify_4_do==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    my ($sigurdgy,$sigurdgy_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Gylfi Þór",
                                birthdate=>"08.09.1989",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    print "U: $sigurdgy\n";

    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mendel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\9b\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/9b/".$mendelgr,
                   sn=>"Mendel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@".$root_dns,
                   sophomorixAdminClass => "9b",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mendel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "9b|wifi|internet|webfilter|intranet|printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Russel Wallace",
                   givenName=>"Alfred Russel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\students\\12b\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/uni/students/12b/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@".$root_dns,
                   sophomorixAdminClass => "uni-12b",
                   sophomorixExitAdminClass => "bsz-m3kk4t",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Russel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-12b|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });

    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    my $dn_gunnarar="CN=".$gunnarar.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    my $dn_sigurdra="CN=".$sigurdra.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy must be killed by now
    &AD_object_nonexist($ldap,$root_dse,"user",$sigurdgy);

#     my $dn_sigurdgy="CN=".$sigurdgy.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
#     &AD_test_object({ldap=>$ldap,
#                    dn=>$dn_sigurdgy,
#                    #####
#                    displayName=>"Gylfi Þór Sigurðsson",
#                    givenName=>"Gylfi Þór",
#                    name=>$sigurdgy,
#                    sAMAccountname=>$sigurdgy,
#                    homeDrive=>"H:",
#                    homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdgy,
#                    unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdgy,
#                    sn=>"Sigurðsson",
#                    userPrincipalName => $sigurdgy."@".$root_dns,
#                    mail => $sigurdgy."@".$root_dns,
#                    sophomorixAdminClass => "7a",
#                    sophomorixExitAdminClass => "unknown",
#                    sophomorixFirstPassword => "Muster!",
#                    sophomorixFirstnameASCII => "Gylfi Thor",
#                    sophomorixSurnameASCII  => "Sigurdsson",
#                    sophomorixFirstnameInitial => "G. Þ.",
#                    sophomorixSurnameInitial  => "S.",
#                    sophomorixCloudQuotaCalculated => "---",
#                    sophomorixUserToken => "---",
#                    sophomorixBirthdate  => "08.09.1989",
#                    sophomorixRole => "student",
#                    sophomorixSchoolPrefix => "---",
#                    sophomorixSchoolname => "default-school",
#                    sophomorixCreationDate => "exists",
#                    sophomorixTolerationDate => "exists",
#                    sophomorixDeactivationDate => "exists",
#                    sophomorixComment => "created by sophomorix",
#                    sophomorixExamMode => "---",
#                    sophomorixStatus => "R",
#                    sophomorixUnid => "---",
#                    accountExpires => "0",
#                    userAccountControl => "66050",
#                    memberOf => "7a|wifi|internet|webfilter|intranet|printing",
#                   });
    ##### Testing the users class
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$halldoha."|".$gunnarar."|".$sigurdra,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $halldoha."|".$gunnarar."|".$sigurdra,
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk4t,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk4t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk4t@"."adminclass.net",
                   description=>"bsz-m3kk4t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-12b,OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-12b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "uni-12b@".$root_dns,
                   description=>"uni-12b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"uni:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$wallacal,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "uni-students",
                   member => $wallacal,
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=9b,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"9b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "9b@".$root_dns,
                   description=>"9b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$mendelgr,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $mendelgr,
                  });

    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "attic|7a|9b|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|bsz-m3kk4t|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-students,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "uni-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-students",
                   member => "uni-12b|global-students",
                  });


    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\teachers\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/uni/teachers/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@".$root_dns,
                   sophomorixAdminClass => "uni-teachers",
                   sophomorixExitAdminClass => "bsz-teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-teachers|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwin",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/darwi99",
                   sn=>"Darwin",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "9b",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwin",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=skula99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99 must be killed by now
    &AD_object_nonexist($ldap,$root_dse,"user","bjarna99");
#     &AD_test_object({ldap=>$ldap,
#                    dn=>"CN=bjarna99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
#                    #####
#                    displayName=>"Theódór Elmar Bjarnason",
#                    givenName=>"Theódór Elmar",
#                    name=>"bjarna99",
#                    sAMAccountname=>"bjarna99",
#                    homeDrive=>"H:",
#                    homeDirectory=>"\\\\bionic\\default-school\\teachers\\bjarna99",
#                    unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/bjarna99",
#                    sn=>"Bjarnason",
#                    userPrincipalName => "bjarna99@".$root_dns,
#                    mail => "bjarna99@".$root_dns,
#                    sophomorixAdminClass => "teachers",
#                    sophomorixExitAdminClass => "unknown",
# #                   sophomorixFirstPassword => "LinuxMuster!",
#                    sophomorixFirstnameASCII => "Theodor Elmar",
#                    sophomorixSurnameASCII  => "Bjarnason",
#                    sophomorixFirstnameInitial => "T. E.",
#                    sophomorixSurnameInitial  => "B.",
#                    sophomorixCloudQuotaCalculated => "---",
#                    sophomorixUserToken => "---",
#                    sophomorixBirthdate  => "04.03.1987",
#                    sophomorixRole => "teacher",
#                    sophomorixSchoolPrefix => "---",
#                    sophomorixSchoolname => "default-school",
#                    sophomorixCreationDate => "exists",
#                    sophomorixTolerationDate => "exists",
#                    sophomorixDeactivationDate => "exists",
#                    sophomorixComment => "created by sophomorix",
#                    sophomorixExamMode => "---",
#                    sophomorixStatus => "R",
#                    accountExpires => "0",
#                    userAccountControl => "66050",
#                    memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
#                   });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"darwi99|rukri99|olinst99|skula99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => "darwi99|rukri99|olinst99|skula99|global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>"koperni99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => "koperni99|global-teachers",
                  });
}





############################################################
# --modify-5-check --modify-5-do
############################################################
if ($modify_5_check==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";
    my $command_modify_5="sophomorix-check $all_options ".
                "--injectline \"students.csv:9b;Kopernikus;Nikolaus;19.02.1973;\" ".
                "--injectline \"uni.students.csv:12b;Darwin;Charles;12.02.2009;\" ".
                "--injectline \"uni.teachers.csv:teachers;Mendel;Gregor;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Wallace;Alfred Russel;01.01.2000;\" ".
                "--injectline \"teachers.csv:teachers;Stefánsson;Ólafur Indriði;03.07.1973;olinst99\" ".
                "--injectline \"teachers.csv:teachers;Kristinsson;Rúnar;05.09.1969;rukri99\" ".             # back
                "--injectline \"teachers.csv:teachers;Skúlason;Ari Freyr;14.05.1987;skula99\" ".            # back
#                "--injectline \"teachers.csv:teachers;Bjarnason;Theódór Elmar;04.03.1987;bjarna99\" ".     # removed
                "--injectline \"students.csv:7a;Halldórsson;Hannes Þór;27.04.1984;\" ".
                "--injectline \"students.csv:7a;Gunnarsson;Aron;22.04.1989;\" ".                            # back
                "--injectline \"students.csv:7a;Sigurðsson;Ragnar;19.06.1986;\" ";                          # back
#                "--injectline \"students.csv:7a;Sigurðsson;Gylfi Þór;08.09.1989;\" ".""                    # removed
    ############################################################
    # kill the users, that can be killed and test again
    ############################################################
    &run_command($command_modify_5);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",4);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",6);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}
############################################################
if ($modify_5_do==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";

    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");

    # $mendelgr
    my $dn_mendelgr="CN=".$mendelgr.",OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_mendelgr,
                   #####
                   displayName=>"Gregor Mendel",
                   givenName=>"Gregor",
                   name=>$mendelgr,
                   sAMAccountname=>$mendelgr,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\teachers\\".$mendelgr,
                   unixHomeDirectory=>"/srv/samba/schools/uni/teachers/".$mendelgr,
                   sn=>"Mendel",
                   userPrincipalName => $mendelgr."@".$root_dns,
                   mail => $mendelgr."@".$root_dns,
                   sophomorixAdminClass => "uni-teachers",
                   sophomorixExitAdminClass => "9b",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Gregor",
                   sophomorixSurnameASCII  => "Mendel",
                   sophomorixFirstnameInitial => "G.",
                   sophomorixSurnameInitial  => "M.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-teachers|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });
    # $wallacal
    my $dn_wallacal="CN=".$wallacal.",OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_wallacal,
                   #####
                   displayName=>"Alfred Russel Wallace",
                   givenName=>"Alfred Russel",
                   name=>$wallacal,
                   sAMAccountname=>$wallacal,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\".$wallacal,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/".$wallacal,
                   sn=>"Wallace",
                   userPrincipalName => $wallacal."@".$root_dns,
                   mail => $wallacal."@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "uni-12b",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Alfred Russel",
                   sophomorixSurnameASCII  => "Wallace",
                   sophomorixFirstnameInitial => "A. R.",
                   sophomorixSurnameInitial  => "W.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "01.01.2000",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # $halldoha
    my $dn_halldoha="CN=".$halldoha.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_halldoha,
                   #####
                   displayName=>"Hannes Þór Halldórsson",
                   givenName=>"Hannes Þór",
                   name=>$halldoha,
                   sAMAccountname=>$halldoha,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$halldoha,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$halldoha,
                   sn=>"Halldórsson",
                   userPrincipalName => $halldoha."@".$root_dns,
                   mail => $halldoha."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Hannes Thor",
                   sophomorixSurnameASCII  => "Halldorsson",
                   sophomorixFirstnameInitial => "H. Þ.",
                   sophomorixSurnameInitial  => "H.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "27.04.1984",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $gunnarar
    my $dn_gunnarar="CN=".$gunnarar.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_gunnarar,
                   #####
                   displayName=>"Aron Gunnarsson",
                   givenName=>"Aron",
                   name=>$gunnarar,
                   sAMAccountname=>$gunnarar,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$gunnarar,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$gunnarar,
                   sn=>"Gunnarsson",
                   userPrincipalName => $gunnarar."@".$root_dns,
                   mail => $gunnarar."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Aron",
                   sophomorixSurnameASCII  => "Gunnarsson",
                   sophomorixFirstnameInitial => "A.",
                   sophomorixSurnameInitial  => "G.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "22.04.1989",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdra
    my $dn_sigurdra="CN=".$sigurdra.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
    &AD_test_object({ldap=>$ldap,
                   dn=>$dn_sigurdra,
                   #####
                   displayName=>"Ragnar Sigurðsson",
                   givenName=>"Ragnar",
                   name=>$sigurdra,
                   sAMAccountname=>$sigurdra,
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdra,
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdra,
                   sn=>"Sigurðsson",
                   userPrincipalName => $sigurdra."@".$root_dns,
                   mail => $sigurdra."@".$root_dns,
                   sophomorixAdminClass => "7a",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "Muster!",
                   sophomorixFirstnameASCII => "Ragnar",
                   sophomorixSurnameASCII  => "Sigurdsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.06.1986",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "7a|wifi|internet|webfilter|intranet|printing",
                  });
    # $sigurdgy must be killed by now
#    &AD_object_nonexist($ldap,$root_dse,"user",$sigurdgy);

#     my $dn_sigurdgy="CN=".$sigurdgy.",OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse;
#     &AD_test_object({ldap=>$ldap,
#                    dn=>$dn_sigurdgy,
#                    #####
#                    displayName=>"Gylfi Þór Sigurðsson",
#                    givenName=>"Gylfi Þór",
#                    name=>$sigurdgy,
#                    sAMAccountname=>$sigurdgy,
#                    homeDrive=>"H:",
#                    homeDirectory=>"\\\\bionic\\default-school\\students\\7a\\".$sigurdgy,
#                    unixHomeDirectory=>"/srv/samba/schools/default-school/students/7a/".$sigurdgy,
#                    sn=>"Sigurðsson",
#                    userPrincipalName => $sigurdgy."@".$root_dns,
#                    mail => $sigurdgy."@".$root_dns,
#                    sophomorixAdminClass => "7a",
#                    sophomorixExitAdminClass => "unknown",
# #                   sophomorixFirstPassword => "Muster!",
#                    sophomorixFirstnameASCII => "Gylfi Thor",
#                    sophomorixSurnameASCII  => "Sigurdsson",
#                    sophomorixFirstnameInitial => "G. Þ.",
#                    sophomorixSurnameInitial  => "S.",
#                    sophomorixCloudQuotaCalculated => "---",
#                    sophomorixUserToken => "---",
#                    sophomorixBirthdate  => "08.09.1989",
#                    sophomorixRole => "student",
#                    sophomorixSchoolPrefix => "---",
#                    sophomorixSchoolname => "default-school",
#                    sophomorixCreationDate => "exists",
#                    sophomorixTolerationDate => "exists",
#                    sophomorixDeactivationDate => "exists",
#                    sophomorixComment => "created by sophomorix",
#                    sophomorixExamMode => "---",
#                    sophomorixStatus => "R",
#                    sophomorixUnid => "---",
#                    accountExpires => "0",
#                    userAccountControl => "66050",
#                    memberOf => "7a|wifi|internet|webfilter|intranet|printing",
#                   });
    ##### Testing the users class
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>$halldoha."|".$gunnarar."|".$sigurdra,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => $halldoha."|".$gunnarar."|".$sigurdra,
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk4t,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk4t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk4t@"."adminclass.net",
                   description=>"bsz-m3kk4t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-12b,OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-12b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "uni-12b@".$root_dns,
                   description=>"uni-12b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"uni:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"darwi99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "uni-students",
                   member => "darwi99",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=9b,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"9b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "9b@".$root_dns,
                   description=>"9b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"koperni99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "koperni99",
                  });

    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                    sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "attic|7a|9b|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|bsz-m3kk4t|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-students,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "uni-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-students",
                   member => "uni-12b|global-students",
                  });


    # koperni99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=koperni99,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Nikolaus Kopernikus",
                   givenName=>"Nikolaus",
                   name=>"koperni99",
                   sAMAccountname=>"koperni99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\students\\9b\\koperni99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/students/9b/koperni99",
                   sn=>"Kopernikus",
                   userPrincipalName => "koperni99@".$root_dns,
                   mail => "koperni99@".$root_dns,
                   sophomorixAdminClass => "9b",
                   sophomorixExitAdminClass => "uni-teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Nikolaus",
                   sophomorixSurnameASCII  => "Kopernikus",
                   sophomorixFirstnameInitial => "N.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "19.02.1973",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "9b|wifi|internet|webfilter|intranet|printing",
                  });

    # darwi99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=darwi99,OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Charles Darwin",
                   givenName=>"Charles",
                   name=>"darwi99",
                   sAMAccountname=>"darwi99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\uni\\students\\12b\\darwi99",
                   unixHomeDirectory=>"/srv/samba/schools/uni/students/12b/darwi99",
                   sn=>"Darwin",
                   userPrincipalName => "darwi99@".$root_dns,
                   mail => "darwi99@".$root_dns,
                   sophomorixAdminClass => "uni-12b",
                   sophomorixExitAdminClass => "teachers",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Charles",
                   sophomorixSurnameASCII  => "Darwin",
                   sophomorixFirstnameInitial => "C.",
                   sophomorixSurnameInitial  => "D.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "12.02.2009",
                   sophomorixRole => "student",
                   sophomorixSchoolPrefix => "uni",
                   sophomorixSchoolname => "uni",
                   sophomorixAdminFile => "uni.students.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: true|lm:quotas:apply: false",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "S",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "uni-12b|uni-wifi|uni-internet|uni-webfilter|uni-intranet|uni-printing",
                  });

    # olinst99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=olinst99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ólafur Indriði Stefánsson",
                   givenName=>"Ólafur Indriði",
                   name=>"olinst99",
                   sAMAccountname=>"olinst99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\olinst99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/olinst99",
                   sn=>"Stefánsson",
                   userPrincipalName => "olinst99@".$root_dns,
                   mail => "olinst99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster23!",
                   sophomorixFirstnameASCII => "Olafur Indridi",
                   sophomorixSurnameASCII  => "Stefansson",
                   sophomorixFirstnameInitial => "Ó. I.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "03.07.1973",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   sophomorixUnid => "---",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });

    # rukri99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=rukri99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Rúnar Kristinsson",
                   givenName=>"Rúnar",
                   name=>"rukri99",
                   sAMAccountname=>"rukri99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\rukri99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/rukri99",
                   sn=>"Kristinsson",
                   userPrincipalName => "rukri99@".$root_dns,
                   mail => "rukri99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Runar",
                   sophomorixSurnameASCII  => "Kristinsson",
                   sophomorixFirstnameInitial => "R.",
                   sophomorixSurnameInitial  => "K.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "05.09.1969",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # skula99
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=skula99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   #####
                   displayName=>"Ari Freyr Skúlason",
                   givenName=>"Ari Freyr",
                   name=>"skula99",
                   sAMAccountname=>"skula99",
                   homeDrive=>"H:",
                   homeDirectory=>"\\\\bionic\\default-school\\teachers\\skula99",
                   unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/skula99",
                   sn=>"Skúlason",
                   userPrincipalName => "skula99@".$root_dns,
                   mail => "skula99@".$root_dns,
                   sophomorixAdminClass => "teachers",
                   sophomorixExitAdminClass => "attic",
#                   sophomorixFirstPassword => "LinuxMuster!",
                   sophomorixFirstnameASCII => "Ari Freyr",
                   sophomorixSurnameASCII  => "Skulason",
                   sophomorixFirstnameInitial => "A. F.",
                   sophomorixSurnameInitial  => "S.",
                   sophomorixCloudQuotaCalculated => "---",
                   sophomorixUserToken => "---",
                   sophomorixBirthdate  => "14.05.1987",
                   sophomorixRole => "teacher",
                   sophomorixSchoolPrefix => "---",
                   sophomorixSchoolname => "default-school",
                   sophomorixAdminFile => "teachers.csv",
                   sophomorixCreationDate => "exists",
                   sophomorixTolerationDate => "default",
                   sophomorixDeactivationDate => "default",
                   sophomorixComment => "created by sophomorix",
                   sophomorixWebuiDashboard => "---",
                   sophomorixWebuiPermissions => "",
                   sophomorixWebuiPermissionsCalculated => "lm:printers: false|lm:quotas:apply: true",
                   sophomorixExamMode => "---",
                   sophomorixStatus => "A",
                   accountExpires => "0",
                   userAccountControl => "66048",
                   memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
                  });
    # bjarna99 must be killed by now
    &AD_object_nonexist($ldap,$root_dse,"user","bjarna99");
#     &AD_test_object({ldap=>$ldap,
#                    dn=>"CN=bjarna99,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
#                    #####
#                    displayName=>"Theódór Elmar Bjarnason",
#                    givenName=>"Theódór Elmar",
#                    name=>"bjarna99",
#                    sAMAccountname=>"bjarna99",
#                    homeDrive=>"H:",
#                    homeDirectory=>"\\\\bionic\\default-school\\teachers\\bjarna99",
#                    unixHomeDirectory=>"/srv/samba/schools/default-school/teachers/bjarna99",
#                    sn=>"Bjarnason",
#                    userPrincipalName => "bjarna99@".$root_dns,
#                    mail => "bjarna99@".$root_dns,
#                    sophomorixAdminClass => "teachers",
#                    sophomorixExitAdminClass => "unknown",
# #                   sophomorixFirstPassword => "LinuxMuster!",
#                    sophomorixFirstnameASCII => "Theodor Elmar",
#                    sophomorixSurnameASCII  => "Bjarnason",
#                    sophomorixFirstnameInitial => "T. E.",
#                    sophomorixSurnameInitial  => "B.",
#                    sophomorixCloudQuotaCalculated => "---",
#                    sophomorixUserToken => "---",
#                    sophomorixBirthdate  => "04.03.1987",
#                    sophomorixRole => "teacher",
#                    sophomorixSchoolPrefix => "---",
#                    sophomorixSchoolname => "default-school",
#                    sophomorixCreationDate => "exists",
#                    sophomorixTolerationDate => "exists",
#                    sophomorixDeactivationDate => "exists",
#                    sophomorixComment => "created by sophomorix",
#                    sophomorixExamMode => "---",
#                    sophomorixStatus => "R",
#                    accountExpires => "0",
#                    userAccountControl => "66050",
#                    memberOf => "teachers|wifi|internet|webfilter|intranet|printing",
#                   });
    ##### Testing the users ou-teachers group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>$wallacal."|rukri99|olinst99|skula99",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => $wallacal."|rukri99|olinst99|skula99|global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>$mendelgr,
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => $mendelgr."|global-teachers",
                  });

}





############################################################
# --modify-10-check --modify-10-do
############################################################
if ($modify_10_check==1){
}
############################################################
if ($modify_10_do==1){

}





############################################################
# --modify-10-test
############################################################
if ($modify_10_test==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });

    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";

    # create the project p_full-blown
    my $pro_command="sophomorix-project $all_options ".
                    "--create -p full-blown  --description 'Full blown project' ".
                    "--addquota default-school:33,linuxmuster-global:66 --addmailquota 200 ".
                    "--mailalias --maillist ".
                    "--status P --join --nohide --maxmembers 36 ".
                    "--admins rukri99,olinst99 --members skula99,".$gunnarar.",".$halldoha." ".
                    "--membergroups 7a --admingroups teachers";

    &run_command("$pro_command");

    # test the project p_full-blown
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=p_full-blown,OU=Projects,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"p_full-blown",
                   description=>"Full blown project",
                   sophomorixType=>"project",
                   mail => "p_full-blown@".$root_dns,
                   sophomorixAddQuota=>"default-school:33:---:|linuxmuster-global:66:---:",
                   sophomorixAddMailQuota=>"200:---:",
                   sophomorixMailAlias=>"TRUE",
                   sophomorixMailList=>"TRUE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMaxMembers=>"36",
                   sophomorixAdmins => "rukri99|olinst99",
                   sophomorixMembers => $halldoha."|".$gunnarar."|skula99",
                   sophomorixAdminGroups => "teachers",
                   sophomorixMemberGroups => "7a",
                   sophomorixCreationDate => "exists",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "",
                   member => "7a|teachers|rukri99|olinst99|skula99|".$halldoha."|".$gunnarar,
                  });
}





############################################################
# Deleting users --kill
############################################################
if ($kill_user_check==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";

    &run_command("sophomorix-user $all_options -K --user koperni99");
    &run_command("sophomorix-user $all_options -K --user darwi99");

    &run_command("sophomorix-user $all_options -R --user olinst99");
    &run_command("sophomorix-user $all_options -R --user rukri99");
    &run_command("sophomorix-user $all_options -R --user skula99");

    &run_command("sophomorix-user $all_options -K --user $mendelgr");
    &run_command("sophomorix-user $all_options -K --user $wallacal");

    &run_command("sophomorix-user $all_options -R --user $halldoha");
    &run_command("sophomorix-user $all_options -R --user $gunnarar");
    &run_command("sophomorix-user $all_options -R --user $sigurdra");

    &run_command("sophomorix-check $all_options");
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",10);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",10);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}

############################################################
if ($kill_user_do==1){
    # fetch loginnames:
    my ($mendelgr,$mendelgr_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Mendel",
                                givenName=>"Gregor",
                                birthdate=>"01.01.2000",
                               });
    my ($wallacal,$wallacal_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Wallace",
                                givenName=>"Alfred Russel",
                                birthdate=>"01.01.2000",
                               });
    my ($halldoha,$halldoha_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Halldórsson",
                                givenName=>"Hannes Þór",
                                birthdate=>"27.04.1984",
                               });
    my ($gunnarar,$gunnarar_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Gunnarsson",
                                givenName=>"Aron",
                                birthdate=>"22.04.1989",
                               });
    my ($sigurdra,$sigurdra_dn)=&AD_get_samaccountname({ldap=>$ldap,
                                root_dse=>$root_dse,
                                sn=>"Sigurðsson",
                                givenName=>"Ragnar",
                                birthdate=>"19.06.1986",
                               });
    print "U: $mendelgr\n";
    print "U: $wallacal\n";
    print "U: $halldoha\n";
    print "U: $gunnarar\n";
    print "U: $sigurdra\n";

    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");
}

if ($kill_user_test==1){
    &AD_object_nonexist($ldap,$root_dse,"user","mondelgr");
    &AD_object_nonexist($ldap,$root_dse,"user","mondelgr1");
    &AD_object_nonexist($ldap,$root_dse,"user","mondelgr2");

    &AD_object_nonexist($ldap,$root_dse,"user","wallacal");
    &AD_object_nonexist($ldap,$root_dse,"user","wallacal1");
    &AD_object_nonexist($ldap,$root_dse,"user","wallacal2");

    &AD_object_nonexist($ldap,$root_dse,"user","halldoha");
    &AD_object_nonexist($ldap,$root_dse,"user","halldoha1");
    &AD_object_nonexist($ldap,$root_dse,"user","halldoha2");

    &AD_object_nonexist($ldap,$root_dse,"user","gunnarar");
    &AD_object_nonexist($ldap,$root_dse,"user","gunnarar1");
    &AD_object_nonexist($ldap,$root_dse,"user","gunnarar2");

    &AD_object_nonexist($ldap,$root_dse,"user","sigurdra");
    &AD_object_nonexist($ldap,$root_dse,"user","sigurdra1");
    &AD_object_nonexist($ldap,$root_dse,"user","sigurdra2");

    &AD_object_nonexist($ldap,$root_dse,"user","koperni99");
    &AD_object_nonexist($ldap,$root_dse,"user","darwi99");

    &AD_object_nonexist($ldap,$root_dse,"user","olinst99");
    &AD_object_nonexist($ldap,$root_dse,"user","rukri99");
    &AD_object_nonexist($ldap,$root_dse,"user","skula99");

    # killing rukri99,olinst99 should remove them from the project p_full-blown
    # 7a and teachers are still members, because they still exist
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=p_full-blown,OU=Projects,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"p_full-blown",
                   description=>"Full blown project",
                   sophomorixType=>"project",
                   mail => "p_full-blown@".$root_dns,
                   sophomorixAddQuota=>"default-school:33:---:|linuxmuster-global:66:---:",
                   sophomorixAddMailQuota=>"200:---:",
                   sophomorixMailAlias=>"TRUE",
                   sophomorixMailList=>"TRUE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMaxMembers=>"36",
                   sophomorixAdmins => "",
                   sophomorixMembers => "",
                   sophomorixAdminGroups => "teachers",
                   sophomorixMemberGroups => "7a",
                   sophomorixCreationDate => "exists",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "",
                   member => "7a|teachers",
                  });

    ##### Testing the users ou-teachers group
    # empty sophomorixMembers,sophomorixAdmins but teachers is still member of project p_full-blown
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers|p_full-blown",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => "global-teachers",
                  });


    ##### Testing the users class
    # empty sophomorixMembers,sophomorixAdmins but 7a is still member of project p_full-blown
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=7a,OU=7a,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"7a",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "7a@".$root_dns,
                   description=>"7a",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students|p_full-blown",
                   member => "",
                  });
    ##### Testing attic
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=attic,OU=attic,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"attic",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "attic@".$root_dns,
                   description=>"attic",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk3t,OU=m3kk3t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk3t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk3t@"."adminclass.net",
                   description=>"bsz-m3kk3t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-m3kk4t,OU=m3kk4t,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-m3kk4t",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "bsz-m3kk4t@"."adminclass.net",
                   description=>"bsz-m3kk4t",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"bsz:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "bsz-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-12b,OU=12b,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-12b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "uni-12b@".$root_dns,
                   description=>"uni-12b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"uni:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "uni-students",
                   member => "",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=9b,OU=9b,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"9b",
                   sophomorixCreationDate => "exists",
                   sophomorixType=>"adminclass",
                   mail => "9b@".$root_dns,
                   description=>"9b",
                   sophomorixAddQuota=>"---",
                   sophomorixAddMailQuota=>"---",
                   sophomorixQuota=>"default-school:---:---:|linuxmuster-global:---:---:",
                   sophomorixMailQuota=>"---:---:",
                   sophomorixMailAlias=>"FALSE",
                   sophomorixMailList=>"FALSE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "students",
                   member => "",
                  });


    ##### Testing the users ou-students group
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "attic|7a|9b|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "bsz-m3kk3t|bsz-m3kk4t|global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-students,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "uni-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-students",
                   member => "uni-attic|uni-12b|global-students",
                  });
}


if ($kill_adminclasses_check==1){
    &run_command("sophomorix-class --kill --class 7a $all_options");
    &run_command("sophomorix-class --kill --class 9b $all_options");
    &run_command("sophomorix-class --kill --class attic $all_options");
    &run_command("sophomorix-class --kill --class bsz-m3kk3t $all_options");
    &run_command("sophomorix-class --kill --class bsz-m3kk4t $all_options");
    &run_command("sophomorix-class --kill --class uni-12b $all_options");
    &run_command("sophomorix-class --kill --class uni-attic $all_options");

    &run_command("sophomorix-check $all_options");
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}

if ($kill_adminclasses_do==1){
    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");
}

if ($kill_adminclasses_test==1){
    &AD_object_nonexist($ldap,$root_dse,"group","7a");
    &AD_object_nonexist($ldap,$root_dse,"group","9b");
    &AD_object_nonexist($ldap,$root_dse,"group","bsz-m3kk3t");
    &AD_object_nonexist($ldap,$root_dse,"group","bsz-m3kk4t");
    &AD_object_nonexist($ldap,$root_dse,"group","uni-12b");

    # killing 7a should remove it from the project p_full-blown
    # group teachers is still a member, because it still exists
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=p_full-blown,OU=Projects,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"p_full-blown",
                   description=>"Full blown project",
                   sophomorixType=>"project",
                   mail => "p_full-blown@".$root_dns,
                   sophomorixAddQuota=>"default-school:33:---:|linuxmuster-global:66:---:",
                   sophomorixAddMailQuota=>"200:---:",
                   sophomorixMailAlias=>"TRUE",
                   sophomorixMailList=>"TRUE",
                   sophomorixStatus=>"P",
                   sophomorixJoinable=>"TRUE",
                   sophomorixMaxMembers=>"36",
                   sophomorixAdmins => "",
                   sophomorixMembers => "",
                   sophomorixAdminGroups => "teachers",
                   sophomorixMemberGroups => "",
                   sophomorixCreationDate => "exists",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "",
                   member => "teachers",
                  });


    ##### Testing the users ou-teachers group
    # empty sophomorixMembers,sophomorixAdmins but teachers is still member of project p_full-blown
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers|p_full-blown",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => "global-teachers",
                  });

}


if ($kill_projects_check==1){
    # kill the project p_full-blown
    &run_command("sophomorix-project $all_options --kill -p full-blown");

    &run_command("sophomorix-check $all_options");
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.add",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.update",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.kill",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.nochange",0);
    &file_test_lines("/var/lib/sophomorix/check-result/sophomorix.error",0);
}

if ($kill_projects_do==1){
    &run_command("sophomorix-add $all_options");
    &run_command("sophomorix-update $all_options");
    &run_command("sophomorix-kill $all_options");
}

if ($kill_projects_test==1){
    # test if project was deleted
    &AD_object_nonexist($ldap,$root_dse,"group","p_full-blown");

    &AD_object_nonexist($ldap,$root_dse,"group","7a");
    &AD_object_nonexist($ldap,$root_dse,"group","9b");
    &AD_object_nonexist($ldap,$root_dse,"group","bsz-m3kk3t");
    &AD_object_nonexist($ldap,$root_dse,"group","bsz-m3kk4t");
    &AD_object_nonexist($ldap,$root_dse,"group","uni-12b");

    ##### Testing the users ou-teachers group
    # teachers should be removed from p_full-blown
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=teachers,OU=Teachers,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-teachers,OU=Teachers,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "bsz-teachers@"."teacherclass.net",
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-teachers",
                   member => "global-teachers",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-teachers,OU=Teachers,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-teachers",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"teacherclass",
                   mail => "uni-teachers@".$root_dns,
                   sophomorixMembers=>"",
                   sophomorixAdmins=>"",
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-teachers",
                   member => "global-teachers",
                  });

    ##### Testing the users ou-students group
    # should be empty
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=students,OU=Students,OU=default-school,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "default-school",
                   memberOf => "s_default-school|all-students",
                   member => "global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=bsz-students,OU=Students,OU=bsz,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"bsz-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "bsz-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "bsz",
                   memberOf => "s_bsz|all-students",
                   member => "global-students",
                  });
    &AD_test_object({ldap=>$ldap,
                   dn=>"CN=uni-students,OU=Students,OU=uni,OU=SCHOOLS,".$root_dse,
                   sAMAccountname=>"uni-students",
                   sophomorixCreationDate => "exists",
                   sophomorixStatus=>"P",
                   sophomorixType=>"ouclass",
                   mail => "uni-students@".$root_dns,
                   sophomorixHidden=>"FALSE",
                   sophomorixSchoolname => "uni",
                   memberOf => "s_uni|all-students",
                   member => "global-students",
                  });
}



&AD_unbind_admin($ldap);
