%import pyeole.ssha

SET NAMES utf8;
SET time_zone = '+00:00';
SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';

INSERT IGNORE INTO `niveau01` (`id`, `label`, `siren`) VALUES
%if %%is_defined("cadolesuser_niveau01name")
(-100, '%%cadolesuser_niveau01name', '%%cadolesuser_niveau01siren');
%else
(-100, '%%libelle_etab', '%%numero_etab');
%end if

%if %%getVar("cadolesuser_syncldap", 'non') == "oui"
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', '%%cadolesuser_organization', '%%pyeole.ssha.ssha_encode(%%cadolesuser_pwdadmin)', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%cadolesuser_niveau01siren', 'simple');
%else
INSERT IGNORE INTO `user` (`id`, `niveau01_id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`,`siren`,`authlevel`) VALUES
(-100, -100, 'admin', 'Administrateur', '%%libelle_etab', 'PWD_CAS', '%%system_mail_to', 'admin.jpg', 'ROLE_ADMIN', '%%numero_etab', 'simple');
%end if

TRUNCATE TABLE sidebar;
INSERT IGNORE INTO `sidebar` (`id`, `parent_id`, `roworder`, `label`, `path`, `fonticon`, `permission`) VALUES
(1000,	NULL,	1000,	'CONFIGIRATION',	'',	'fa-gear',	'ROLE_ADMIN,ROLE_MODO'),
(1200,	1000,	1200,	'Organisations',	NULL,	'fa-sitemap',	'ROLE_ADMIN,ROLE_MODO'),
(1210,	1200,	1210,	'Listes Blanche',	'cadoles_core_config_whitelist',	'fa-tasks',	'ROLE_ADMIN'),
(1220,	1200,	1220,	'Niveau 01',	'cadoles_core_config_niveau01',	'fa-building',	'ROLE_ADMIN'),
%if %%getVar("cadolesuser_niveau02view", 'non') == "oui"
(1230,	1200,	1230,	'Niveau 02',	'cadoles_core_config_niveau02',	'fa-sitemap',	'ROLE_ADMIN,ROLE_MODO'),
%end if
(1240,	1200,	1240,	'Groupes',	'cadoles_core_config_group',	'fa-users',	'ROLE_ADMIN,ROLE_MODO'),
(1250,	1200,	1250,	'Inscriptions',	'cadoles_core_config_registration',	'fa-pencil-square-o',	'ROLE_ADMIN,ROLE_MODO'),
(1260,	1200,	1260,	'Utilisateurs',	'cadoles_core_config_user',	'fa-child',	'ROLE_ADMIN,ROLE_MODO');