<?xml version="1.0" encoding="utf-8"?>
<creole>
    <files>
		<file filelist='posh-profil-bareos' name='/etc/bareos/bareosfichiers.d/posh-profil.conf' source='posh-profil-bareos.conf' rm='True'/>
        <file filelist='posh-profil' name='/etc/eole/eole-db.d/posh-profil-db.yml' rm='True' mkdir='True'/>
        <file filelist='posh-profil' name='/usr/share/eole/db/posh-profil/gen/posh-profil-create1.sql' mkdir='True' rm='True'/>
        <file filelist='posh-profil' name='/usr/share/eole/db/posh-profil/updates/posh-profil-update1.sql' rm='True' mkdir='True'/>
        <file filelist='posh-profil' name='/usr/share/eole/db/posh-profil/updates/posh-profil-update2.sql' rm='True' mkdir='True'/>
    </files>

	<containers>
		<container name="web">
            <package>posh-profil-apps</package>

            <file filelist='posh-profil' name='/etc/apache2/sites-available/posh-profil' source='posh-profil-apache.conf'/>
            <file filelist="posh-profil" name="/var/www/html/posh-profil/include/envole.php" source="posh-profil-envole.php" rm="True"/>
            <file filelist="posh-profil" name="/var/www/html/posh-profil/include/dbconf.php" source="posh-profil-dbconf.php" rm="True"/>
            <file filelist="posh-profil" name="/var/www/html/posh-profil/include/xdesktop.php" source="posh-profil-xdesktop.php" rm="True"/>
            <file filelist="posh-profil" name="/var/www/html/posh-profil/script/unread.php" source="posh-profil-unread.php" rm="True"/>
            <file filelist="posh-profil" name="/var/www/html/posh-profil/script/synchronisation.sh" source="posh-profil-synchronisation.sh" rm="True" mode="755" />
            <!-- fichier de configuration pour la migration -->
            <file filelist='posh-profil-migration' name='/var/www/html/envole-migration/config/config-db-poshprofil.php' source='posh-profil-migration.php' mkdir='True'/>
            <service method="apache" servicelist="posh-profil">posh-profil</service>
		</container>
	</containers>

    <variables>
        <family name='envole'>
            <variable name='activer_poshprofil' type='oui/non' description='Activation de Posh Profil'>
                <value>oui</value>
            </variable>
            <variable name='poshprofil_newitem' type='string' description="Affecter par défaut les nouvelles applications au profil">
                <value>Tout le monde</value>
            </variable>
            <variable name='poshprofil_typesynchro' type='string' description='Type de synchronisation'>
                <value>ENT</value>
            </variable>
            <variable name='activer_addadmin' type='oui/non' description='Ajouter un uid de type administrateur envole'>
                <value>non</value>
            </variable>
            <variable name='uid_addadmin' type='string' description='UID de votre second administrateur envole' mandatory='True'>
                <value></value>
            </variable>
            <variable name='alias_poshprofil' type='string' description='Alias apache pour posh-profil' mandatory='True'>
                <value>posh-profil</value>
            </variable>

        </family>

        <family name='posh-profil' mode='expert'>
            <variable type='string' name='poshprofil_db_mode' description='Serveur de bases de données à utiliser'/>
            <variable type='string' name='poshprofil_dbserver' description='Adresse du serveur de base de données'/>
            <variable type='number' name='poshprofil_dbport' description="Port d'écoute du serveur de base de données"/>
            <variable type='string' name='poshprofil_allow_hosts' description="Hôtes authorisés à utiliser la base de données" multi='True'/>
            <variable type='string' name='poshprofil_dbuser' description='Utilisateur du serveur de base de données'/>
            <variable type='string' name='poshprofil_dbpass' description='Fichier de mot de passe du serveur'/>
        </family>
    </variables>

    <constraints>
        <check name='valid_enum' target='poshprofil_typesynchro'>
             <param>['ENT', 'Annuaire']</param>
        </check>

        <check name='valid_enum' target='poshprofil_newitem'>
             <param>['Administrateur', 'Tout le monde']</param>
        </check>

        <condition name='hidden_if_in' source='activer_apache'>
            <param>non</param>
            <target type='filelist'>posh-profil</target>
            <target type='filelist'>posh-profil-migration</target>
            <target type='filelist'>posh-profil-bareos</target>
            <target type='servicelist'>posh-profil</target>
            <target type='variable'>activer_poshprofil</target>
            <target type='variable'>poshprofil_typesynchro</target>
            <target type='variable'>poshprofil_newitem</target>
            <target type='variable'>activer_addadmin</target>
            <target type='variable'>alias_poshprofil</target>
        </condition>

        <condition name='hidden_if_in' source='activer_poshprofil'>
            <param>non</param>
            <target type='filelist'>posh-profil</target>
            <target type='filelist'>posh-profil-migration</target>
            <target type='filelist'>posh-profil-bareos</target>
            <target type='servicelist'>posh-profil</target>
            <target type='variable'>poshprofil_typesynchro</target>
            <target type='variable'>alias_poshprofil</target>
            <target type='variable'>poshprofil_newitem</target>
        </condition>

        <condition name='hidden_if_in' source='activer_envole_migration' fallback='True'>
            <param>non</param>
            <target type='filelist'>posh-profil-migration</target>
        </condition>

        <condition name='hidden_if_in' source='activer_addadmin'>
            <param>non</param>
            <target type='variable'>uid_addadmin</target>
        </condition>

        <condition name='hidden_if_in' source='activer_bareos_dir' fallback='True'>
            <param>non</param>
            <target type='filelist'>posh-profil-bareos</target>
		</condition>

        <check name='valid_enum' target='poshprofil_db_mode'>
            <param>['default', 'externe', 'local']</param>
        </check>
        <condition name='disabled_if_in' source='poshprofil_db_mode'>
            <param>local</param>
            <target type='variable'>poshprofil_dbserver</target>
            <target type='variable'>poshprofil_dbuser</target>
            <target type='variable'>poshprofil_dbport</target>
            <target type='variable'>poshprofil_dbpass</target>
        </condition>
        <condition name='disabled_if_in' source='poshprofil_db_mode'>
            <param>default</param>
            <target type='variable'>poshprofil_dbserver</target>
            <target type='variable'>poshprofil_dbuser</target>
            <target type='variable'>poshprofil_dbport</target>
            <target type='variable'>poshprofil_dbpass</target>
            <target type='variable'>poshprofil_allow_hosts</target>
        </condition>
    </constraints>

    <help>
        <variable name='activer_poshprofil'>Activation de la gestion des profils Posh</variable>
    </help>
</creole>
