Syntax in the files ./repdir/repdir.*
############################################################
Line syntax:
TYPE::PATH::USER::GROUP::PERMISSIONS::NTACL


TYPE field:
--------------------
LINUX   --> * Treat the path as a unix-path. 
            * Use mkdir, chown, chmod to create dirs and change owner|permissions
            * USER used in chown
            * GROUP used in chown
            * PERMISSIONS used in chmod
            * posix acl not supported at the moment(probably never): noacl 
            This is used for directories that are NOT on a smb share
            i.e. Linux logdirs, ....

SMB     --> * Treat the path as a relative path in a samba share
                 The path must beginn with @@SCHOOL@@/ to specify the share.
                 -> this is expanded to UNC-Path: //linuxmuster.local/@@SCHOOL@@
                 -> The path following left of @@SCHOOL@@/ is the
                    relative path in the  share //linuxmuster.local/@@SCHOOL@@
            * Use smbclient, smbcacls to create dirs/set ntacls
            * USER not used at the moment
            * GROUP not used at the moment
            * PERMISSIONS not used at the moment
            * ntacls are supported
            This is used for directories on a smb share          


Variables in PATH field:
--------------------
  School:
  ----------
  @@SCHOOL@@         -> the schools (including default-school, but not global)

  Group:
  ----------
  @@TEACHERCLASS@@   -> the teacherclass(es) of @@SCHOOL@@
                        (@@SCHOOL@@ must be written left of @@TEACHERCLASS@@)

  @@ADMINCLASS@@     -> the adminclass (classes of administration software) of @@SCHOOL@@
                        (@@SCHOOL@@ must be written left of @@ADMINCLASS@@)

  @@PROJECT@@        -> the projects of @@SCHOOL@@
                         (@@SCHOOL@@ must be written left of @@PROJECT@@)
  User:
  ----------
  @@USER@@           -> the user in the group left of @@USER@@



Variables in NTACLS:
############################################################

see: Variables in PATH field above

Perhaps more to come, ...



Tools for debugging and testing:
############################################################
A) Show ntacls:
     # sophomorix-cacls /abs/unix/path

B) Adding/Removing/Changing a path:
     1) edit ./repdir/repdir.<what_you_need>
     2) # sophohomorix-repair

C) Changing NTACLs:
     1) edit ./ntacl/<what_you_need>.ntacl.template
     2) # sophohomorix-repair


Testing
############################################################
To test the creation of diretories:

1) make sure that one share for each school exists:

   https://github.com/linuxmuster/sophomorix4/blob/bionic/tools/add-school-shares

2) Add some users: (so that homedirs,sharedirs, ... will be created)
   # sophomorix-test-1 --add -s

3) Repair all directories
   # sophomorix-repair --all



Programming interna:
############################################################

To see, which dirs AD_repdir_using_file creates, see:  

  ./repdir-hierarchy.png

AD_repdir_using_file repairs multiple users, groups, schools, ...
when called like in sophomorix-repair

When creating/repairing ONE user-home, group-share, school then:
 - load %sophomorix_config
 - 
 - all @@VAR@@ in the file (and the ntacl file) must be given as option
 - The option of AD_repdir_using_file is the lowercase name of @@VAR@@: 

# Examples  
# creating the Global school 
   &AD_repdir_using_file({root_dns=>$root_dns,
                         school=>$ref_sophomorix_config->{'INI'}{'VARS'}{'GLOBALSHARENAME'},
                         repdir_file=>"repdir.global",
                         AD=>\%AD,
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });



# creating ONE School: ( --school (red) in repdir-hierarchy.png)
   &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.school",
                         school=>"bsz",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });


#creating ONE project in ONE school: ( --project (dark-yellow) in repdir-hierarchy.png)
   &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.project",
                         school=>"default-school",
                         project=>"p_astro",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });


#creating ONE administrator home in ONE school: ( --administrator-home (dark-cyan) in repdir-hierarchy.png)
  &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.administrator_home",
                         school=>"abc",
                         administrator_home=>"admin10",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });


#creating ONE teacher_home in ONE teacherclass in ONE school: ( --teacher-home (dark-magenta) in repdir-hierarchy.png)
   &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.teacher_home",
                         school=>"bsz",
                         teacherclass=>"teachers",
                         teacher_home=>"oe42",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });


#creating ONE adminclass in ONE school: ( --adminclass (dark-red) in repdir-hierarchy.png)
   &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.adminclass",
                         school=>"bsz",
                         adminclass=>"bsz-m7ab",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });

#creating ONE student_home in ONE adminclass in ONE school: ( --student-home (magenta) in repdir-hierarchy.png)
   &AD_repdir_using_file({root_dns=>$root_dns,
                         repdir_file=>"repdir.student_home",
                         school=>"bsz",
                         adminclass=>"bsz-m7ab",
                         student_home=>"maiersa42",
                         smb_admin_pass=>$smb_admin_pass,
                         sophomorix_config=>\%sophomorix_config,
                         sophomorix_result=>\%sophomorix_result,
                        });