Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
173ceacc8e
|
@ -84,10 +84,16 @@
|
||||||
<variable type='string' name='ninegate_mode_auth' description="Mode Authentification" mandatory='True'><value>CAS</value></variable>
|
<variable type='string' name='ninegate_mode_auth' description="Mode Authentification" mandatory='True'><value>CAS</value></variable>
|
||||||
<variable type='string' name='ninegate_api_key' description="Clé d'accès API" mandatory='True'><value>APIKeyNinegate</value></variable>
|
<variable type='string' name='ninegate_api_key' description="Clé d'accès API" mandatory='True'><value>APIKeyNinegate</value></variable>
|
||||||
|
|
||||||
|
<variable type='oui/non' name='ninegate_ssosynchrogroup' description="Générer automatiquement les groupes en fonction d'un attribut SSO"><value>oui</value></variable>
|
||||||
|
<variable type='string' name='ninegate_ssoreqgroup' description="Attribut SSO associé à la notion de groupe" mandatory='True'><value>user_groups</value></variable>
|
||||||
|
|
||||||
<variable type='oui/non' name='ninegate_syncldap' description="Synchroniser Ninegate vers votre Annuaire CadolesLDAP"><value>non</value></variable>
|
<variable type='oui/non' name='ninegate_syncldap' description="Synchroniser Ninegate vers votre Annuaire CadolesLDAP"><value>non</value></variable>
|
||||||
<variable type='string' name='ninegate_ldaptemplate' description="Modèle d'annuaire"><value>scribe</value></variable>
|
<variable type='string' name='ninegate_ldaptemplate' description="Modèle d'annuaire"><value>scribe</value></variable>
|
||||||
<variable type='oui/non' name='ninegate_scribegroup' description="Considérer les classes/options comme des groupes de travail"><value>oui</value></variable>
|
<variable type='oui/non' name='ninegate_scribegroup' description="Considérer les classes/options comme des groupes de travail"><value>oui</value></variable>
|
||||||
<variable type='oui/non' name='ninegate_scribemaster' description="Placer les professeurs comme manager des groupes classes/options"><value>oui</value></variable>
|
<variable type='string' name='ninegate_scribemaster' description="Placer les professeurs comme manager des groupes classes/options"><value>oui</value></variable>
|
||||||
|
<variable type='string' name='ninegate_openldapreqniveau01' description="Lors de l'initalisation de Ninegate requete LDAP utilisateur de votre premier Niveau01" mandatory='True'><value>(uid=*)</value></variable>
|
||||||
|
<variable type='oui/non' name='ninegate_openldapsynchrogroup' description="Générer automatiquement les groupes en fonction de votre annuaire"><value>oui</value></variable>
|
||||||
|
<variable type='string' name='ninegate_openldapreqgroup' description="Générer automatiquement les groupes en fonction de votre annuaire" mandatory='True'><value>(objectClass=posixGroup)</value></variable>
|
||||||
|
|
||||||
<variable type='string' name='ninegate_pwdadmin' description="Mot de passe du compte admin durant l'instance (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
|
<variable type='string' name='ninegate_pwdadmin' description="Mot de passe du compte admin durant l'instance (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
|
||||||
<variable type='string' name='ninegate_organization' description="Nom de l'organisation principale (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
|
<variable type='string' name='ninegate_organization' description="Nom de l'organisation principale (idem valeur Cadoles ldap)" mandatory='True'><value></value></variable>
|
||||||
|
@ -423,11 +429,16 @@
|
||||||
<target type='variable'>ninegate_mode_auth</target>
|
<target type='variable'>ninegate_mode_auth</target>
|
||||||
<target type='variable'>ninegate_api_key</target>
|
<target type='variable'>ninegate_api_key</target>
|
||||||
|
|
||||||
|
<target type='variable'>ninegate_ssosynchrogroup</target>
|
||||||
|
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||||
|
|
||||||
<target type='variable'>ninegate_syncldap</target>
|
<target type='variable'>ninegate_syncldap</target>
|
||||||
<target type='variable'>ninegate_ldaptemplate</target>
|
<target type='variable'>ninegate_ldaptemplate</target>
|
||||||
<target type='variable'>ninegate_scribegroup</target>
|
<target type='variable'>ninegate_scribegroup</target>
|
||||||
<target type='variable'>ninegate_scribemaster</target>
|
<target type='variable'>ninegate_scribemaster</target>
|
||||||
|
<target type='variable'>ninegate_openldapreqniveau01</target>
|
||||||
|
<target type='variable'>ninegate_openldapsynchrogroup</target>
|
||||||
|
<target type='variable'>ninegate_openldapreqgroup</target>
|
||||||
|
|
||||||
<target type='variable'>ninegate_pwdadmin</target>
|
<target type='variable'>ninegate_pwdadmin</target>
|
||||||
<target type='variable'>ninegate_organization</target>
|
<target type='variable'>ninegate_organization</target>
|
||||||
|
@ -507,6 +518,14 @@
|
||||||
<target type='variable'>ninegate_test_conf_cadolesldap</target>
|
<target type='variable'>ninegate_test_conf_cadolesldap</target>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
|
<condition name='hidden_if_in' source='ninegate_masteridentity'>
|
||||||
|
<param>SQL</param>
|
||||||
|
<param>LDAP</param>
|
||||||
|
|
||||||
|
<target type='variable'>ninegate_ssosynchrogroup</target>
|
||||||
|
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||||
|
</condition>
|
||||||
|
|
||||||
<condition name='hidden_if_in' source='ninegate_syncldap'>
|
<condition name='hidden_if_in' source='ninegate_syncldap'>
|
||||||
<param>non</param>
|
<param>non</param>
|
||||||
|
|
||||||
|
@ -565,7 +584,12 @@
|
||||||
<param name='mismatch'>non</param>
|
<param name='mismatch'>non</param>
|
||||||
</auto>
|
</auto>
|
||||||
|
|
||||||
|
<!-- AFFICHAGE EN FONCTION DE SSO SYNCHRO GROUPE -->
|
||||||
|
<condition name='hidden_if_in' source='ninegate_ssosynchrogroup'>
|
||||||
|
<param>non</param>
|
||||||
|
|
||||||
|
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||||
|
</condition>
|
||||||
|
|
||||||
<!-- AFFICHAGE EN FONCTION DE CADOLESLDAP -->
|
<!-- AFFICHAGE EN FONCTION DE CADOLESLDAP -->
|
||||||
<fill name='calc_val' target='ninegate_pwdadmin'>
|
<fill name='calc_val' target='ninegate_pwdadmin'>
|
||||||
|
@ -604,7 +628,21 @@
|
||||||
<target type='variable'>ninegate_scribemaster</target>
|
<target type='variable'>ninegate_scribemaster</target>
|
||||||
</condition>
|
</condition>
|
||||||
|
|
||||||
|
<!-- AFFICHAGE EN FONCTION DU MODE OPEN -->
|
||||||
|
<condition name='hidden_if_not_in' source='ninegate_ldaptemplate'>
|
||||||
|
<param>open</param>
|
||||||
|
|
||||||
|
<target type='variable'>ninegate_openldapreqniveau01</target>
|
||||||
|
<target type='variable'>ninegate_openldapsynchrogroup</target>
|
||||||
|
<target type='variable'>ninegate_openldapreqgroup</target>
|
||||||
|
</condition>
|
||||||
|
|
||||||
|
<!-- AFFICHAGE EN FONCTION DU LDAP SYNCHRO GROUP -->
|
||||||
|
<condition name='hidden_if_in' source='ninegate_openldapsynchrogroup'>
|
||||||
|
<param>non</param>
|
||||||
|
|
||||||
|
<target type='variable'>ninegate_openldapreqgroup</target>
|
||||||
|
</condition>
|
||||||
|
|
||||||
<!-- AFFICHAGE EN FONCTION DU MODULE PORTAL -->
|
<!-- AFFICHAGE EN FONCTION DU MODULE PORTAL -->
|
||||||
<condition name='hidden_if_in' source='ninegate_activate_portal'>
|
<condition name='hidden_if_in' source='ninegate_activate_portal'>
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
|
||||||
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
|
||||||
|
|
||||||
use Cadoles\CoreBundle\Entity\User;
|
use Cadoles\CoreBundle\Entity\User;
|
||||||
|
use Cadoles\CoreBundle\Entity\Group;
|
||||||
|
|
||||||
class SecurityController extends Controller
|
class SecurityController extends Controller
|
||||||
{
|
{
|
||||||
|
@ -28,7 +29,7 @@ class SecurityController extends Controller
|
||||||
$masteridentity=$this->getParameter("masteridentity");
|
$masteridentity=$this->getParameter("masteridentity");
|
||||||
|
|
||||||
// Init Client CAS
|
// Init Client CAS
|
||||||
\phpCAS::setDebug(false);
|
\phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log");
|
||||||
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
|
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
|
||||||
\phpCAS::setNoCasServerValidation();
|
\phpCAS::setNoCasServerValidation();
|
||||||
|
|
||||||
|
@ -42,12 +43,6 @@ class SecurityController extends Controller
|
||||||
// Récupération Attribut
|
// Récupération Attribut
|
||||||
$attributes = \phpCAS::getAttributes();
|
$attributes = \phpCAS::getAttributes();
|
||||||
|
|
||||||
// Suppression des Attributs en tableaux
|
|
||||||
foreach ($attributes as $key => $value) {
|
|
||||||
if(is_array($value))
|
|
||||||
unset($attributes[$key]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Rechercher l'utilisateur
|
// Rechercher l'utilisateur
|
||||||
$em = $this->getDoctrine()->getManager();
|
$em = $this->getDoctrine()->getManager();
|
||||||
if(isset($attributes[$this->getParameter('user_attr_cas_username')]))
|
if(isset($attributes[$this->getParameter('user_attr_cas_username')]))
|
||||||
|
@ -62,6 +57,7 @@ class SecurityController extends Controller
|
||||||
if(isset($attributes[$this->getParameter('user_attr_cas_firstname')]))
|
if(isset($attributes[$this->getParameter('user_attr_cas_firstname')]))
|
||||||
$firstname = $attributes[$this->getParameter('user_attr_cas_firstname')];
|
$firstname = $attributes[$this->getParameter('user_attr_cas_firstname')];
|
||||||
|
|
||||||
|
|
||||||
$user = $em->getRepository('CadolesCoreBundle:User')->findOneBy(array("username"=>$username));
|
$user = $em->getRepository('CadolesCoreBundle:User')->findOneBy(array("username"=>$username));
|
||||||
$exists = $user ? true : false;
|
$exists = $user ? true : false;
|
||||||
|
|
||||||
|
@ -104,11 +100,18 @@ class SecurityController extends Controller
|
||||||
$user->setAuthlevel("simple");
|
$user->setAuthlevel("simple");
|
||||||
$user->setRole("ROLE_USER");
|
$user->setRole("ROLE_USER");
|
||||||
|
|
||||||
|
if(in_array($username,$this->getParameter("ldap_usersadmin")))
|
||||||
|
$user->setRole("ROLE_ADMIN");
|
||||||
|
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
|
// Génération auto des groupes
|
||||||
|
$this->submitGroup($attributes);
|
||||||
|
|
||||||
// On calcule les groupes de l'utilisateur
|
// On calcule les groupes de l'utilisateur
|
||||||
$groups=$em->getRepository('CadolesCoreBundle:Group')->calculateGroup($user,$attributes);
|
$user=$em->getRepository('CadolesCoreBundle:Group')->calculateGroup($user,$attributes);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -122,13 +125,19 @@ class SecurityController extends Controller
|
||||||
// On s'assure que le niveau 02 appartient bien au niveau 01 calculé
|
// On s'assure que le niveau 02 appartient bien au niveau 01 calculé
|
||||||
$sameniveau01=(!is_null($user->getNiveau02())&&$niveau01==$user->getNiveau02()->getNiveau01());
|
$sameniveau01=(!is_null($user->getNiveau02())&&$niveau01==$user->getNiveau02()->getNiveau01());
|
||||||
|
|
||||||
// On calcule les groupes de l'utilisateur
|
|
||||||
$user=$groups=$em->getRepository('CadolesCoreBundle:Group')->calculateGroup($user,$attributes);
|
|
||||||
|
|
||||||
$user->setLastname($lastname);
|
$user->setLastname($lastname);
|
||||||
$user->setFirstname($firstname);
|
$user->setFirstname($firstname);
|
||||||
$user->setEmail($email);
|
$user->setEmail($email);
|
||||||
if(!$sameniveau01) $user->setNiveau02(null);
|
if(!$sameniveau01) $user->setNiveau02(null);
|
||||||
|
if(in_array($username,$this->getParameter("ldap_usersadmin")))
|
||||||
|
$user->setRole("ROLE_ADMIN");
|
||||||
|
|
||||||
|
// Génération auto des groupes
|
||||||
|
$this->submitGroup($attributes);
|
||||||
|
|
||||||
|
// On calcule les groupes de l'utilisateur
|
||||||
|
$user=$em->getRepository('CadolesCoreBundle:Group')->calculateGroup($user,$attributes);
|
||||||
|
|
||||||
|
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
@ -179,4 +188,84 @@ class SecurityController extends Controller
|
||||||
$url=$this->generateUrl('cadoles_core_home', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
$url=$this->generateUrl('cadoles_core_home', array(), UrlGeneratorInterface::ABSOLUTE_URL);
|
||||||
\phpCAS::logout(array("service"=>$url));
|
\phpCAS::logout(array("service"=>$url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testAction() {
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
// Init Client CAS
|
||||||
|
\phpCAS::setDebug("/var/log/phpcas/phpCAS-ninegate.log");
|
||||||
|
\phpCAS::client(CAS_VERSION_2_0, $this->getParameter('cas_host'), $this->getParameter('cas_port'), is_null($this->getParameter('cas_path')) ? '' : $this->getParameter('cas_path'), false);
|
||||||
|
\phpCAS::setNoCasServerValidation();
|
||||||
|
|
||||||
|
|
||||||
|
// Authentification
|
||||||
|
\phpCAS::forceAuthentication();
|
||||||
|
|
||||||
|
// Récupération UID
|
||||||
|
$username = \phpCAS::getUser();
|
||||||
|
|
||||||
|
// Récupération Attribut
|
||||||
|
$attributes = \phpCAS::getAttributes();
|
||||||
|
$user = $em->getRepository('CadolesCoreBundle:User')->findOneBy(array("username"=>$username));
|
||||||
|
|
||||||
|
// On calcule le niveau01 de l'utilisateur
|
||||||
|
$niveau01=$em->getRepository('CadolesCoreBundle:Niveau01')->calculateNiveau01($attributes);
|
||||||
|
|
||||||
|
// Génération auto des groupes
|
||||||
|
$groups=$this->submitGroup($attributes);
|
||||||
|
|
||||||
|
// On calcule les groupes de l'utilisateur
|
||||||
|
$user=$em->getRepository('CadolesCoreBundle:Group')->calculateGroup($user,$attributes);
|
||||||
|
|
||||||
|
return $this->render('CadolesCASBundle:Test:test.html.twig',[
|
||||||
|
'useheader' => true,
|
||||||
|
'usemenu' => false,
|
||||||
|
'usesidebar' => false,
|
||||||
|
'attributes' => $attributes,
|
||||||
|
'user' => $user,
|
||||||
|
'username' => $username,
|
||||||
|
'niveau01' => $niveau01,
|
||||||
|
]);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private function submitGroup($attributes) {
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
|
||||||
|
if(!$this->getParameter('ssosynchrogroup'))
|
||||||
|
return null;
|
||||||
|
|
||||||
|
$user_attr_cas_group=$this->getParameter('user_attr_cas_group');
|
||||||
|
|
||||||
|
// Si l'utilisateur possège l'attribut groupe dans ses attributs
|
||||||
|
if(array_key_exists($user_attr_cas_group,$attributes)) {
|
||||||
|
if(!is_array($attributes[$user_attr_cas_group])) {
|
||||||
|
$attributes[$user_attr_cas_group]=[$attributes[$user_attr_cas_group]];
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($attributes[$user_attr_cas_group] as $ssogroup) {
|
||||||
|
// Recherche du groupe
|
||||||
|
$group=$em->getRepository("CadolesCoreBundle:Group")->findOneBy(["label"=>$ssogroup]);
|
||||||
|
if(!$group) {
|
||||||
|
$group=new Group();
|
||||||
|
$group->setLabel($ssogroup);
|
||||||
|
$group->setFgcancreatepage(false);
|
||||||
|
$group->setFgcancreateblog(false);
|
||||||
|
$group->setFgcancreatecalendar(false);
|
||||||
|
$group->setFgcancreateproject(false);
|
||||||
|
$group->setFgcanshare(false);
|
||||||
|
$group->setFgopen(false);
|
||||||
|
$group->setFgall(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
$group->setAttributes('{"'.$user_attr_cas_group.'":"'.$ssogroup.'"}');
|
||||||
|
$group->setFgtemplate(false);
|
||||||
|
|
||||||
|
$em->persist($group);
|
||||||
|
$em->flush();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,3 +6,7 @@ cas_sp.logout:
|
||||||
path: /logout
|
path: /logout
|
||||||
defaults: { _controller: CadolesCASBundle:Security:logout }
|
defaults: { _controller: CadolesCASBundle:Security:logout }
|
||||||
|
|
||||||
|
cas_sp.test:
|
||||||
|
path: /test
|
||||||
|
defaults: { _controller: CadolesCASBundle:Security:test }
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
{% extends '@CadolesCore/base.html.twig' %}
|
||||||
|
|
||||||
|
{% block pagewrapper %}
|
||||||
|
<h1>TEST SSO</h1>
|
||||||
|
|
||||||
|
<h2>Atttribut SSO</h2>
|
||||||
|
{% for key, attribute in attributes %}
|
||||||
|
{% if attribute is iterable %}
|
||||||
|
{% for value in attribute %}
|
||||||
|
<strong>{{ key }}</strong> = {{ value }}<br>
|
||||||
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<strong>{{ key }}</strong> = {{ attribute }}<br>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
|
||||||
|
<h2>Correspondance Utilisateur Ninegate</h2>
|
||||||
|
<strong>username</strong> = {{ user.username }}<br>
|
||||||
|
<strong>firstname</strong> = {{ user.firstname }}<br>
|
||||||
|
<strong>lastname</strong> = {{ user.lastname }}<br>
|
||||||
|
<strong>email</strong> = {{ user.email }}<br>
|
||||||
|
|
||||||
|
<h2>Appartient au Niveau 01</h2>
|
||||||
|
<strong>{{ niveau01.label }}</strong> = {{ niveau01.attributes }}
|
||||||
|
|
||||||
|
<h2>Appartient aux Groupes</h2>
|
||||||
|
{% for usergroup in user.groups %}
|
||||||
|
{% if not usergroup.group.attributes is empty %}
|
||||||
|
<strong>{{usergroup.group.label}}</strong> = {{usergroup.group.attributes}}<br>
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
|
<br><br><br><br><br><br><br>
|
||||||
|
{% endblock %}
|
|
@ -144,13 +144,27 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
if($ldap_template=="scribe")
|
if($ldap_template=="scribe")
|
||||||
$niveau01->setLdapfilter("(&(uid=*)(objectclass=inetOrgPerson)(!(description=Computer)))");
|
$niveau01->setLdapfilter("(&(uid=*)(objectclass=inetOrgPerson)(!(description=Computer)))");
|
||||||
else
|
else
|
||||||
$niveau01->setLdapfilter("(uid=*)");
|
$niveau01->setLdapfilter($this->getContainer()->getParameter('openldapreqniveau01'));
|
||||||
|
|
||||||
$em->persist($niveau01);
|
$em->persist($niveau01);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// On s'assure si masteridentity est à SSO qu'au minimum un niveau01 possède un attribut
|
||||||
|
if($masteridentity=="SSO") {
|
||||||
|
$niveau01=$em->createQueryBuilder()->select('n')->from('CadolesCoreBundle:Niveau01','n')->where('n.attributes IS NOT NULL')->getQuery()->getResult();
|
||||||
|
if(!$niveau01) {
|
||||||
|
// Si ce n'est pas le cas on positionne un attribut ultra large sur le niveau01 de base
|
||||||
|
$niveau01=$group=$em->getRepository('CadolesCoreBundle:Niveau01')->find(-100);
|
||||||
|
$niveau01->setAttributes('{"username":"*"}');
|
||||||
|
|
||||||
|
$em->persist($niveau01);
|
||||||
|
$em->flush();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,22 @@ class SynchroCommand extends Command
|
||||||
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,$scribe_group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
elseif($ldap_template=="open") {
|
||||||
|
if($this->container->getParameter('openldapsynchrogroup')) {
|
||||||
|
$this->writeln('');
|
||||||
|
$this->writeln('== GROUPES ==========================================');
|
||||||
|
|
||||||
|
$results = $this->ldap->search($this->container->getParameter('openldapreqgroup'), ['cn','description','gidNumber'], $this->ldap_basedn);
|
||||||
|
foreach($results as $result) {
|
||||||
|
$cn=$result["cn"];
|
||||||
|
$ldapfilter="(&".$this->container->getParameter('openldapreqgroup')."(cn=$cn))";
|
||||||
|
|
||||||
|
$label=$result["cn"];
|
||||||
|
$this->writeln(" - $label");
|
||||||
|
if(!$simulate) $this->addmodGroup($label,$ldapfilter,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
$this->writeln('== USERS ============================================');
|
$this->writeln('== USERS ============================================');
|
||||||
|
@ -760,6 +776,12 @@ class SynchroCommand extends Command
|
||||||
|
|
||||||
protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
|
protected function addmodGroup($label,$ldapfilter,$fgcanshare) {
|
||||||
$portal_activate = $this->container->getParameter('portal_activate');
|
$portal_activate = $this->container->getParameter('portal_activate');
|
||||||
|
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => false, 'label' => $label));
|
||||||
|
if($group) {
|
||||||
|
$this->writelnred(" - ".$label." existe déjà comme groupe interne à Ninegate");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
|
$group=$this->em->getRepository('CadolesCoreBundle:Group')->findOneBy(array('fgtemplate' => true, 'label' => $label));
|
||||||
if(!$group) {
|
if(!$group) {
|
||||||
$group=new Group();
|
$group=new Group();
|
||||||
|
|
|
@ -58,10 +58,10 @@ class TestRestCommand extends Command
|
||||||
// key = parametre obligatoire
|
// key = parametre obligatoire
|
||||||
// key = clé d'accès du l'api
|
// key = clé d'accès du l'api
|
||||||
// only = paramétre optionnel
|
// only = paramétre optionnel
|
||||||
// only = liste des informations désirés = user, items, bookmarks, groups, alerts
|
// only = liste des informations désirés = user, items, bookmarks, groups, alerts, calendars
|
||||||
$apiurl = $url."/rest/user/".$login;
|
$apiurl = $url."/rest/user/".$login;
|
||||||
$this->writeln($apiurl);
|
$this->writeln($apiurl);
|
||||||
$response = \Unirest\Request::post($apiurl,$headers,["key"=>$masterapikey,"only"=>"user,items"]);
|
$response = \Unirest\Request::post($apiurl,$headers,["key"=>$masterapikey,"only"=>"user,calendars"]);
|
||||||
dump($response->body);
|
dump($response->body);
|
||||||
|
|
||||||
$this->writeln('');
|
$this->writeln('');
|
||||||
|
|
|
@ -34,7 +34,7 @@ class RestController extends Controller
|
||||||
// key = parametre obligatoire
|
// key = parametre obligatoire
|
||||||
// key = clé d'accès de l'api
|
// key = clé d'accès de l'api
|
||||||
// only = paramétre optionnel
|
// only = paramétre optionnel
|
||||||
// only = liste des informations désirés = user, items, bookmarks, groups, alerts
|
// only = liste des informations désirés = user, items, bookmarks, groups, alerts, calendars
|
||||||
public function userAction($login, Request $request)
|
public function userAction($login, Request $request)
|
||||||
{
|
{
|
||||||
$key=$request->get('key');
|
$key=$request->get('key');
|
||||||
|
@ -65,6 +65,8 @@ class RestController extends Controller
|
||||||
if($only==""||in_array("groups",$only)) $output["groups"] = [];
|
if($only==""||in_array("groups",$only)) $output["groups"] = [];
|
||||||
if($only==""||in_array("alerts",$only)) $output["alerts"] = [];
|
if($only==""||in_array("alerts",$only)) $output["alerts"] = [];
|
||||||
if($only==""||in_array("alerts",$only)) $output["alertcategorys"] = [];
|
if($only==""||in_array("alerts",$only)) $output["alertcategorys"] = [];
|
||||||
|
if($only==""||in_array("calendars",$only)) $output["calendars"] = [];
|
||||||
|
if($only==""||in_array("calendars",$only)) $output["calendarevents"] = [];
|
||||||
|
|
||||||
$bookmarks=null;
|
$bookmarks=null;
|
||||||
$items=null;
|
$items=null;
|
||||||
|
@ -94,7 +96,7 @@ class RestController extends Controller
|
||||||
$tmp["url"] = $bookmark->getUrl();
|
$tmp["url"] = $bookmark->getUrl();
|
||||||
$tmp["target"] = $bookmark->getTarget();
|
$tmp["target"] = $bookmark->getTarget();
|
||||||
$tmp["order"] = 0;
|
$tmp["order"] = 0;
|
||||||
$tmp["color"] = ($bookmark->getColor()?$bookmark->getColor():$this->get('session')->get('color')["main"]);
|
$tmp["color"] = "#".($bookmark->getColor()?$bookmark->getColor():$this->get('session')->get('color')["main"]);
|
||||||
$tmp["icon"] = $weburl.($bookmark->getIcon()?$bookmark->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
$tmp["icon"] = $weburl.($bookmark->getIcon()?$bookmark->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
||||||
|
|
||||||
array_push($output["bookmarks"],$tmp);
|
array_push($output["bookmarks"],$tmp);
|
||||||
|
@ -111,7 +113,7 @@ class RestController extends Controller
|
||||||
$tmp["url"] = $item->getUrl();
|
$tmp["url"] = $item->getUrl();
|
||||||
$tmp["target"] = $item->getTarget();
|
$tmp["target"] = $item->getTarget();
|
||||||
$tmp["order"] = $item->getRoworder();
|
$tmp["order"] = $item->getRoworder();
|
||||||
$tmp["color"] = ($item->getColor()?$item->getColor():$this->get('session')->get('color')["main"]);
|
$tmp["color"] = "#".($item->getColor()?$item->getColor():$this->get('session')->get('color')["main"]);
|
||||||
$tmp["icon"] = $weburl.($item->getIcon()?$item->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
$tmp["icon"] = $weburl.($item->getIcon()?$item->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
||||||
$tmp["essential"] = $item->getEssential();
|
$tmp["essential"] = $item->getEssential();
|
||||||
$tmp["category"] = $item->getItemcategory()->getId();
|
$tmp["category"] = $item->getItemcategory()->getId();
|
||||||
|
@ -126,7 +128,7 @@ class RestController extends Controller
|
||||||
$tmp["id"] = $itemcategory->getId();
|
$tmp["id"] = $itemcategory->getId();
|
||||||
$tmp["title"] = $itemcategory->getLabel();
|
$tmp["title"] = $itemcategory->getLabel();
|
||||||
$tmp["order"] = $itemcategory->getRoworder();
|
$tmp["order"] = $itemcategory->getRoworder();
|
||||||
$tmp["color"] = ($itemcategory->getColor()?$itemcategory->getColor():$this->get('session')->get('color')["main"]);
|
$tmp["color"] = "#".($itemcategory->getColor()?$itemcategory->getColor():$this->get('session')->get('color')["main"]);
|
||||||
|
|
||||||
array_push($output["itemcategorys"],$tmp);
|
array_push($output["itemcategorys"],$tmp);
|
||||||
}
|
}
|
||||||
|
@ -162,13 +164,39 @@ class RestController extends Controller
|
||||||
$tmp=[];
|
$tmp=[];
|
||||||
$tmp["id"] = $alertcategory->getId();
|
$tmp["id"] = $alertcategory->getId();
|
||||||
$tmp["title"] = $alertcategory->getLabel();
|
$tmp["title"] = $alertcategory->getLabel();
|
||||||
$tmp["color"] = ($alertcategory->getColor()?$alertcategory->getColor():$this->get('session')->get('color')["main"]);
|
$tmp["color"] = "#".($alertcategory->getColor()?$alertcategory->getColor():$this->get('session')->get('color')["main"]);
|
||||||
$tmp["icon"] = $weburl.($alertcategory->getIcon()?$alertcategory->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
$tmp["icon"] = $weburl.($alertcategory->getIcon()?$alertcategory->getIcon()->getLabel():"uploads/icon/icon_pin.png");
|
||||||
|
|
||||||
array_push($output["alertcategorys"],$tmp);
|
array_push($output["alertcategorys"],$tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($only==""||in_array("calendars",$only)) {
|
||||||
|
|
||||||
|
$events=$em->getRepository("CadolesPortalBundle:Calendarevent")->getUserCalendarevents($user,$this->get('session')->get('color')["main"],null,null,$firstcalendar);
|
||||||
|
foreach($events as $event) {
|
||||||
|
$tmp=[];
|
||||||
|
$tmp["id"] = $event["id"];
|
||||||
|
$tmp["title"] = $event["title"];
|
||||||
|
$tmp["description"] = $event["description"];
|
||||||
|
$tmp['start'] = $event["start"];
|
||||||
|
$tmp['end'] = $event["end"];
|
||||||
|
$tmp['allday'] = $event["allDay"];
|
||||||
|
$tmp['calendar'] = $event["calendar"];
|
||||||
|
|
||||||
|
array_push($output["calendarevents"],$tmp);
|
||||||
|
|
||||||
|
$tmp=[];
|
||||||
|
$tmp["id"] = $event["calendar"];
|
||||||
|
$tmp["title"] = $event["name"];
|
||||||
|
$tmp["color"] = $event["color"];
|
||||||
|
|
||||||
|
if(!in_array($tmp,$output["calendars"]))
|
||||||
|
array_push($output["calendars"],$tmp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Retour
|
// Retour
|
||||||
|
|
|
@ -21,15 +21,15 @@ class GroupRepository extends \Doctrine\ORM\EntityRepository
|
||||||
|
|
||||||
foreach($attgroup as $key => $value) {
|
foreach($attgroup as $key => $value) {
|
||||||
if(array_key_exists($key,$attruser)) {
|
if(array_key_exists($key,$attruser)) {
|
||||||
if(is_array($value)) {
|
if(is_array($attruser[$key])) {
|
||||||
foreach($value as $val) {
|
foreach($attruser[$key] as $val) {
|
||||||
if($val=="*")
|
if($value=="*")
|
||||||
$retgroups->add($group);
|
$retgroups->add($group);
|
||||||
elseif($val==$attruser[$key])
|
elseif($val==$value)
|
||||||
$retgroups->add($group);
|
$retgroups->add($group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif(array_key_exists($key,$attruser)) {
|
else {
|
||||||
if($value=="*")
|
if($value=="*")
|
||||||
$retgroups->add($group);
|
$retgroups->add($group);
|
||||||
elseif($value==$attruser[$key])
|
elseif($value==$attruser[$key])
|
||||||
|
|
|
@ -15,15 +15,15 @@ class Niveau01Repository extends \Doctrine\ORM\EntityRepository
|
||||||
|
|
||||||
foreach($attniveau as $key => $value) {
|
foreach($attniveau as $key => $value) {
|
||||||
if(array_key_exists($key,$attruser)) {
|
if(array_key_exists($key,$attruser)) {
|
||||||
if(is_array($value)) {
|
if(is_array($attruser[$key])) {
|
||||||
foreach($value as $val) {
|
foreach($attruser[$key] as $val) {
|
||||||
if($val=="*")
|
if($value=="*")
|
||||||
return $niveau01;
|
return $niveau01;
|
||||||
elseif($val==$attruser[$key])
|
elseif($val==$value)
|
||||||
return $niveau01;
|
return $niveau01;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(array_key_exists($key,$attruser)) {
|
else {
|
||||||
if($value=="*")
|
if($value=="*")
|
||||||
return $niveau01;
|
return $niveau01;
|
||||||
elseif($value==$attruser[$key])
|
elseif($value==$attruser[$key])
|
||||||
|
|
|
@ -849,6 +849,7 @@ class PagewidgetController extends Controller
|
||||||
|
|
||||||
// Récupération des paramétres du widget
|
// Récupération des paramétres du widget
|
||||||
$idalertcategory=null;
|
$idalertcategory=null;
|
||||||
|
$alertcategoryfilter=null;
|
||||||
foreach($entity->getParameter()["fields"] as $parameter) {
|
foreach($entity->getParameter()["fields"] as $parameter) {
|
||||||
switch($parameter["id"]) {
|
switch($parameter["id"]) {
|
||||||
case "alertcategory":
|
case "alertcategory":
|
||||||
|
@ -863,87 +864,7 @@ class PagewidgetController extends Controller
|
||||||
|
|
||||||
// Profilage
|
// Profilage
|
||||||
$user=$this->getUser();
|
$user=$this->getUser();
|
||||||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
$alertsordered=$em->getRepository("CadolesPortalBundle:Alert")->getUserAlerts($user,$idalertcategory,$alertcategoryfilter);
|
||||||
$niveau01=($user?$user->getNiveau01():null);
|
|
||||||
$groups=($user?$user->getGroups():[]);
|
|
||||||
|
|
||||||
// Initialisation du calcul des alerts
|
|
||||||
$alerts=new ArrayCollection();
|
|
||||||
|
|
||||||
// Récupération des alerts par rôles
|
|
||||||
foreach($roles as $role) {
|
|
||||||
$qb = $em->createQueryBuilder();
|
|
||||||
$qb->select('alert')
|
|
||||||
->from("CadolesPortalBundle:Alert", 'alert')
|
|
||||||
->where($qb->expr()->like('alert.roles', $qb->expr()->literal("%$role%")))
|
|
||||||
->andWhere('alert.publishedat <= :today')
|
|
||||||
->andWhere($qb->expr()->orX(
|
|
||||||
$qb->expr()->gt('alert.unpublishedat', ':today'),
|
|
||||||
$qb->expr()->isNull('alert.unpublishedat')
|
|
||||||
))
|
|
||||||
->setParameter('today', date('Y-m-d'));
|
|
||||||
|
|
||||||
if($idalertcategory && $alertcategoryfilter) {
|
|
||||||
$qb->andWhere("alert.alertcategory=:alertcategory")
|
|
||||||
->setParameter("alertcategory",$alertcategoryfilter);
|
|
||||||
}
|
|
||||||
$alertsroles=$qb->getQuery()->getResult();
|
|
||||||
foreach($alertsroles as $alertrole) {
|
|
||||||
if(!$alerts->contains($alertrole)&&!$alertrole->getReaders()->contains($this->getUser())) $alerts->add($alertrole);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Récupération par Niveau01
|
|
||||||
$qb = $em->createQueryBuilder();
|
|
||||||
$qb->select('alert')
|
|
||||||
->from("CadolesPortalBundle:Alert", 'alert')
|
|
||||||
->where(":niveau01 MEMBER OF alert.niveau01s")
|
|
||||||
->andWhere('alert.publishedat <= :today')
|
|
||||||
->andWhere($qb->expr()->orX(
|
|
||||||
$qb->expr()->gt('alert.unpublishedat', ':today'),
|
|
||||||
$qb->expr()->isNull('alert.unpublishedat')
|
|
||||||
))
|
|
||||||
->setParameter("niveau01",$niveau01)
|
|
||||||
->setParameter('today', date('Y-m-d'));
|
|
||||||
|
|
||||||
if($idalertcategory && $alertcategoryfilter) {
|
|
||||||
$qb->andWhere("alert.alertcategory=:alertcategory")
|
|
||||||
->setParameter("alertcategory",$alertcategoryfilter);
|
|
||||||
}
|
|
||||||
$alertsniveau01s=$qb->getQuery()->getResult();
|
|
||||||
foreach($alertsniveau01s as $alertniveau01) {
|
|
||||||
if(!$alerts->contains($alertniveau01)&&!$alertniveau01->getReaders()->contains($this->getUser())) $alerts->add($alertniveau01);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Récupération des alerts par group
|
|
||||||
foreach($groups as $group) {
|
|
||||||
$qb = $em->createQueryBuilder();
|
|
||||||
$qb->select('alert')
|
|
||||||
->from("CadolesPortalBundle:Alert", 'alert')
|
|
||||||
->where(":group MEMBER OF alert.groups")
|
|
||||||
->andWhere('alert.publishedat <= :today')
|
|
||||||
->andWhere($qb->expr()->orX(
|
|
||||||
$qb->expr()->gt('alert.unpublishedat', ':today'),
|
|
||||||
$qb->expr()->isNull('alert.unpublishedat')
|
|
||||||
))
|
|
||||||
->setParameter("group",$group->getGroup())
|
|
||||||
->setParameter('today', date('Y-m-d'));
|
|
||||||
|
|
||||||
if($idalertcategory && $alertcategoryfilter) {
|
|
||||||
$qb->andWhere("alert.alertcategory=:alertcategory")
|
|
||||||
->setParameter("alertcategory",$alertcategoryfilter);
|
|
||||||
}
|
|
||||||
$alertsgroups=$qb->getQuery()->getResult();
|
|
||||||
foreach($alertsgroups as $alertgroup) {
|
|
||||||
if(!$alerts->contains($alertgroup)&&!$alertgroup->getReaders()->contains($this->getUser())) $alerts->add($alertgroup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Trie des alerts
|
|
||||||
$alertsordered = $alerts->getIterator();
|
|
||||||
$alertsordered->uasort(function ($first, $second) {
|
|
||||||
return (int) $first->getRowOrder() > (int) $second->getRowOrder() ? 1 : -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
return $this->render($this->labelentity.':viewalert.html.twig', [
|
return $this->render($this->labelentity.':viewalert.html.twig', [
|
||||||
|
@ -1721,82 +1642,9 @@ class PagewidgetController extends Controller
|
||||||
// Préference utilisateur
|
// Préference utilisateur
|
||||||
$this->getPreference($entity);
|
$this->getPreference($entity);
|
||||||
|
|
||||||
// On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur
|
// Récupérer les events de l'utilisateur
|
||||||
if($usage=="group") {
|
$user=$this->getUser();
|
||||||
$calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($this->getUser(),$group);
|
$events=$em->getRepository("CadolesPortalBundle:Calendarevent")->getUserCalendarevents($user,$this->get('session')->get('color')["main"],$usage,$group,$firstcalendar);
|
||||||
if($calendars) $firstcalendar=$calendars[0]->getId();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$this->getDoctrine()->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($this->getUser(),$calendarssuser,$calendarsadmin,$calendarsshared);
|
|
||||||
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
|
|
||||||
$firstcalendar="all";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Début & fin
|
|
||||||
$start=new \DateTime();
|
|
||||||
$start->setTime(0,0);
|
|
||||||
|
|
||||||
$end=new \DateTime();
|
|
||||||
$end->setTime(0,0);
|
|
||||||
$end->add(new \DateInterval('P3M'));
|
|
||||||
$end->modify('last day of this month');
|
|
||||||
|
|
||||||
$events=[];
|
|
||||||
$eventids=[];
|
|
||||||
|
|
||||||
foreach($calendars as $calendar) {
|
|
||||||
$calendarevents = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventByDate($calendar,$start,$end);
|
|
||||||
|
|
||||||
foreach($calendarevents as $calendarevent) {
|
|
||||||
$tmp=[];
|
|
||||||
$tmp['id'] = strval($calendarevent->getId());
|
|
||||||
$tmp['title'] = $calendarevent->getName();
|
|
||||||
$tmp['description'] = $calendarevent->getDescription();
|
|
||||||
$tmp['start'] = $calendarevent->getStart();
|
|
||||||
$tmp['end'] = $calendarevent->getEnd();
|
|
||||||
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
|
||||||
$tmp['allDay'] = $calendarevent->getAllday();
|
|
||||||
$tmp['calendar'] = $calendar->getId();
|
|
||||||
$tmp['editable'] = $calendar->getCanupdate();
|
|
||||||
|
|
||||||
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
|
|
||||||
if($tmp['allDay'])
|
|
||||||
$tmp['end']->sub(new \DateInterval('PT1S'));
|
|
||||||
|
|
||||||
array_push($events,$tmp);
|
|
||||||
array_push($eventids,$tmp["id"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// On récupére les évenement partagé de l'utilisateur
|
|
||||||
if($this->getUser()) {
|
|
||||||
$calendarevents = $this->getDoctrine()->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventGroupsShareByDate($this->getUser(),$start,$end);
|
|
||||||
foreach($calendarevents as $calendarevent) {
|
|
||||||
if($usage=="group") {
|
|
||||||
if(!$calendarevent->getGroups()->contains($groupentity)) continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmp=[];
|
|
||||||
$tmp['id'] = strval($calendarevent->getId());
|
|
||||||
$tmp['title'] = $calendarevent->getName();
|
|
||||||
$tmp['description'] = $calendarevent->getDescription();
|
|
||||||
$tmp['start'] = $calendarevent->getStart();
|
|
||||||
$tmp['end'] = $calendarevent->getEnd();
|
|
||||||
$tmp['color'] = "#".(is_null($calendar->getColor())?$this->get('session')->get('color')["main"]:$calendar->getColor());
|
|
||||||
$tmp['allDay'] = $calendarevent->getAllday();
|
|
||||||
$tmp['calendar'] = $calendar->getId();
|
|
||||||
$tmp['editable'] = $calendar->getCanupdate();
|
|
||||||
|
|
||||||
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
|
|
||||||
if($tmp['allDay'])
|
|
||||||
$tmp['end']->sub(new \DateInterval('PT1S'));
|
|
||||||
|
|
||||||
if(!in_array($tmp['id'],$eventids)) {
|
|
||||||
array_push($events,$tmp);
|
|
||||||
array_push($eventids,$tmp["id"]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
return $this->render($this->labelentity.':viewcalendar.html.twig', [
|
return $this->render($this->labelentity.':viewcalendar.html.twig', [
|
||||||
|
|
|
@ -93,4 +93,89 @@ class CalendareventRepository extends EntityRepository
|
||||||
|
|
||||||
return $calendareventshared;
|
return $calendareventshared;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getUserCalendarevents($user,$sessioncolor,$usage,$group,&$firstcalendar) {
|
||||||
|
$em=$this->getEntityManager();
|
||||||
|
|
||||||
|
// On récupère soit les calendriers du group en cours soit l'ensemble des calendriers de l'utilisateur
|
||||||
|
if($usage=="group") {
|
||||||
|
$calendars=$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsGroup($user,$group);
|
||||||
|
if($calendars) $firstcalendar=$calendars[0]->getId();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$em->getRepository("CadolesPortalBundle:Calendar")->getCalendarsUser($user,$calendarssuser,$calendarsadmin,$calendarsshared);
|
||||||
|
$calendars=array_merge($calendarssuser,$calendarsadmin->toArray(),$calendarsshared);
|
||||||
|
$firstcalendar="all";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Début & fin
|
||||||
|
$start=new \DateTime();
|
||||||
|
$start->setTime(0,0);
|
||||||
|
|
||||||
|
$end=new \DateTime();
|
||||||
|
$end->setTime(0,0);
|
||||||
|
$end->add(new \DateInterval('P3M'));
|
||||||
|
$end->modify('last day of this month');
|
||||||
|
|
||||||
|
$events=[];
|
||||||
|
$eventids=[];
|
||||||
|
|
||||||
|
foreach($calendars as $calendar) {
|
||||||
|
$calendarevents = $em->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventByDate($calendar,$start,$end);
|
||||||
|
|
||||||
|
foreach($calendarevents as $calendarevent) {
|
||||||
|
$tmp=[];
|
||||||
|
$tmp['id'] = strval($calendarevent->getId());
|
||||||
|
$tmp['title'] = $calendarevent->getName();
|
||||||
|
$tmp['description'] = $calendarevent->getDescription();
|
||||||
|
$tmp['start'] = $calendarevent->getStart();
|
||||||
|
$tmp['end'] = $calendarevent->getEnd();
|
||||||
|
$tmp['color'] = "#".(is_null($calendar->getColor())?$sessioncolor:$calendar->getColor());
|
||||||
|
$tmp['allDay'] = $calendarevent->getAllday();
|
||||||
|
$tmp['calendar'] = $calendar->getId();
|
||||||
|
$tmp['name'] = $calendar->getName();
|
||||||
|
$tmp['editable'] = $calendar->getCanupdate();
|
||||||
|
|
||||||
|
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
|
||||||
|
if($tmp['allDay'])
|
||||||
|
$tmp['end']->sub(new \DateInterval('PT1S'));
|
||||||
|
|
||||||
|
array_push($events,$tmp);
|
||||||
|
array_push($eventids,$tmp["id"]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On récupére les évenement partagé de l'utilisateur
|
||||||
|
if($user) {
|
||||||
|
$calendarevents = $em->getRepository("CadolesPortalBundle:Calendarevent")->getCalendareventGroupsShareByDate($user,$start,$end);
|
||||||
|
foreach($calendarevents as $calendarevent) {
|
||||||
|
if($usage=="group") {
|
||||||
|
if(!$calendarevent->getGroups()->contains($groupentity)) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tmp=[];
|
||||||
|
$tmp['id'] = strval($calendarevent->getId());
|
||||||
|
$tmp['title'] = $calendarevent->getName();
|
||||||
|
$tmp['description'] = $calendarevent->getDescription();
|
||||||
|
$tmp['start'] = $calendarevent->getStart();
|
||||||
|
$tmp['end'] = $calendarevent->getEnd();
|
||||||
|
$tmp['color'] = "#".(is_null($calendar->getColor())?$sessioncolor:$calendar->getColor());
|
||||||
|
$tmp['allDay'] = $calendarevent->getAllday();
|
||||||
|
$tmp['calendar'] = $calendar->getId();
|
||||||
|
$tmp['name'] = $calendar->getName();
|
||||||
|
$tmp['editable'] = $calendar->getCanupdate();
|
||||||
|
|
||||||
|
// Si évènement sur la journée on enlève une 1 seconde à la date de fin
|
||||||
|
if($tmp['allDay'])
|
||||||
|
$tmp['end']->sub(new \DateInterval('PT1S'));
|
||||||
|
|
||||||
|
if(!in_array($tmp['id'],$eventids)) {
|
||||||
|
array_push($events,$tmp);
|
||||||
|
array_push($eventids,$tmp["id"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $events;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
[user]
|
[attributes]
|
||||||
user=uid
|
user=uid
|
||||||
|
|
||||||
[username]
|
|
||||||
username=uid
|
username=uid
|
||||||
|
|
||||||
[firstname]
|
|
||||||
firstname=givenName
|
firstname=givenName
|
||||||
|
|
||||||
[lastname]
|
|
||||||
lastname=sn
|
lastname=sn
|
||||||
|
|
||||||
[email]
|
|
||||||
email=mail
|
email=mail
|
||||||
|
user_groups=user_groups
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,23 @@ parameters:
|
||||||
scribe_master: false
|
scribe_master: false
|
||||||
%end if
|
%end if
|
||||||
|
|
||||||
|
%if %%getVar("ninegate_ldaptemplate", 'non') == "open"
|
||||||
|
openldapreqniveau01: %%ninegate_openldapreqniveau01
|
||||||
|
|
||||||
|
%if %%getVar("ninegate_openldapsynchrogroup", 'non') == "oui"
|
||||||
|
openldapsynchrogroup: true
|
||||||
|
openldapreqgroup: %%ninegate_openldapreqgroup
|
||||||
|
%else
|
||||||
|
openldapsynchrogroup: false
|
||||||
|
openldapreqgroup:
|
||||||
|
%end if
|
||||||
|
%else
|
||||||
|
openldapreqniveau01:
|
||||||
|
openldapsynchrogroup: false
|
||||||
|
openldapreqgroup:
|
||||||
|
%end if
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Activation Widget
|
# Activation Widget
|
||||||
%if %%getVar("ninegate_activate_widadminer", 'non') == "oui"
|
%if %%getVar("ninegate_activate_widadminer", 'non') == "oui"
|
||||||
|
@ -471,6 +488,14 @@ parameters:
|
||||||
user_attr_saml_lastname: sn
|
user_attr_saml_lastname: sn
|
||||||
user_attr_saml_firstname: givenName
|
user_attr_saml_firstname: givenName
|
||||||
|
|
||||||
|
%if %%getVar("ninegate_ssosynchrogroup", 'non') == "oui"
|
||||||
|
ssosynchrogroup: true
|
||||||
|
user_attr_cas_group: %%ninegate_ssoreqgroup
|
||||||
|
%else
|
||||||
|
ssosynchrogroup: fase
|
||||||
|
user_attr_cas_group:
|
||||||
|
%end if
|
||||||
|
|
||||||
%if %%is_defined("ninegate_smtpport")
|
%if %%is_defined("ninegate_smtpport")
|
||||||
mailer_port: '%%ninegate_smtpport'
|
mailer_port: '%%ninegate_smtpport'
|
||||||
mailer_encryption: %%ninegate_smtpencryption
|
mailer_encryption: %%ninegate_smtpencryption
|
||||||
|
|
Loading…
Reference in New Issue