#!/bin/bash
. /etc/sysconfig/schoolserver

for i in /home/profile/??*
do
    uid=`basename $i`
    chmod -R 700 $i
    chown -R $uid  $i
    setfacl -d -m u::rwx $i
    setfacl -R -m u::rwx $i
    echo "Repairing $i"
done
for i in /home/teachers/??*
do
    uid=`basename $i`
    chmod -R 711 $i
    chown -R $uid  $i
    echo "Repairing $i"
done
for i in /home/students/??*
do
    uid=`basename $i`
    chmod -R 711 $i
    chown -R $uid  $i
    if [ $SCHOOL_TEACHER_OBSERV_HOME = "yes" ]
    then
      setfacl -m m::rwx $i
      setfacl -R -m g:teachers:rwx $i
      setfacl -d -m g:teachers:rwx $i
    fi
    echo "Repairing $i"
done
