Merge branch 'master' into dist/envole/6/master
This commit is contained in:
commit
8dc2d81ab3
|
@ -86,6 +86,8 @@
|
|||
|
||||
<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_ssosynchroitem' description="Associer automatiquement les items en fonction d'un attribut SSO"><value>non</value></variable>
|
||||
<variable type='string' name='ninegate_ssoreqitem' description="Attribut SSO associé à la notion d'item" mandatory='True'><value></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>
|
||||
|
@ -431,6 +433,8 @@
|
|||
|
||||
<target type='variable'>ninegate_ssosynchrogroup</target>
|
||||
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||
<target type='variable'>ninegate_ssosynchroitem</target>
|
||||
<target type='variable'>ninegate_ssoreqitem</target>
|
||||
|
||||
<target type='variable'>ninegate_syncldap</target>
|
||||
<target type='variable'>ninegate_ldaptemplate</target>
|
||||
|
@ -524,6 +528,8 @@
|
|||
|
||||
<target type='variable'>ninegate_ssosynchrogroup</target>
|
||||
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||
<target type='variable'>ninegate_ssosynchroitem</target>
|
||||
<target type='variable'>ninegate_ssoreqitem</target>
|
||||
</condition>
|
||||
|
||||
<condition name='hidden_if_in' source='ninegate_syncldap'>
|
||||
|
@ -591,6 +597,13 @@
|
|||
<target type='variable'>ninegate_ssoreqgroup</target>
|
||||
</condition>
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DE SSO SYNCHRO ITEM -->
|
||||
<condition name='hidden_if_in' source='ninegate_ssosynchroitem'>
|
||||
<param>non</param>
|
||||
|
||||
<target type='variable'>ninegate_ssoreqitem</target>
|
||||
</condition>
|
||||
|
||||
<!-- AFFICHAGE EN FONCTION DE CADOLESLDAP -->
|
||||
<fill name='calc_val' target='ninegate_pwdadmin'>
|
||||
<param type='eole' hidden='False'>cadolesldap_pwdadmin</param>
|
||||
|
|
|
@ -150,6 +150,19 @@ class SecurityController extends Controller
|
|||
// Sauvegarde des attributes en session
|
||||
$this->get('session')->set('attributes', $attributes);
|
||||
|
||||
// Sauvegarde des ssoitems en session
|
||||
$ssoitems=[];
|
||||
if($this->getParameter('ssosynchroitem')) {
|
||||
$user_attr_cas_item=$this->getParameter('user_attr_cas_item');
|
||||
if(array_key_exists($user_attr_cas_item,$attributes)) {
|
||||
if(!is_array($attributes[$user_attr_cas_item])) {
|
||||
$attributes[$user_attr_cas_item]=[$attributes[$user_attr_cas_item]];
|
||||
}
|
||||
$ssoitems=$attributes[$user_attr_cas_item];
|
||||
}
|
||||
}
|
||||
$this->get('session')->set('ssoitems', $ssoitems);
|
||||
|
||||
// Autoconnexion
|
||||
// Récupérer le token de l'utilisateur
|
||||
$token = new UsernamePasswordToken($user, null, "main", $user->getRoles());
|
||||
|
|
|
@ -61,7 +61,7 @@ class TestRestCommand extends Command
|
|||
// only = liste des informations désirés = user, items, bookmarks, groups, alerts, calendars
|
||||
$apiurl = $url."/rest/user/".$login;
|
||||
$this->writeln($apiurl);
|
||||
$response = \Unirest\Request::post($apiurl,$headers,["key"=>$masterapikey,"only"=>"user,items,bookmarks"]);
|
||||
$response = \Unirest\Request::post($apiurl,$headers,["key"=>$masterapikey,"only"=>"user,items,bookmarks","ssoitems"=>"ninegate,toto"]);
|
||||
dump($response->body);
|
||||
|
||||
$this->writeln('');
|
||||
|
|
|
@ -209,5 +209,34 @@ class AjaxController extends Controller
|
|||
$response->headers->set('Content-Type', 'application/json');
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function itemlistAction(Request $request)
|
||||
{
|
||||
// S'assurer que c'est un appel ajax
|
||||
if (!$request->isXmlHttpRequest()) {
|
||||
return new JsonResponse(array('message' => 'Interdit'), 400);
|
||||
}
|
||||
|
||||
$output=array();
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$page_limit=$request->query->get('page_limit');
|
||||
$q=$request->query->get('q');
|
||||
|
||||
$qb = $em->createQueryBuilder();
|
||||
$qb->select('table')->from("CadolesPortalBundle:Item",'table')
|
||||
->where('table.title LIKE :value')
|
||||
->setParameter("value", "%".$q."%")
|
||||
->orderBy('table.title');
|
||||
|
||||
$datas=$qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
|
||||
foreach($datas as $data) {
|
||||
array_push($output,array("id"=>$data->getId(),"text"=>$data->getTitle()));
|
||||
}
|
||||
|
||||
$response = new Response(json_encode($output));
|
||||
$response->headers->set('Content-Type', 'application/json');
|
||||
return $response;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class CoreController extends Controller
|
|||
$itemcategorys=null;
|
||||
|
||||
if($item_activate) {
|
||||
$em->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys);
|
||||
$em->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys,null,$this->get('session')->get('ssoitems'));
|
||||
return $this->render('CadolesPortalBundle:Page:noportal.html.twig',[
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
|
|
|
@ -715,10 +715,11 @@ class GroupController extends Controller
|
|||
$em = $this->getDoctrine()->getManager();
|
||||
|
||||
// Permission
|
||||
$permgroup=$this->get('session')->get('permgroup');
|
||||
if($access=="user") {
|
||||
$permgroup=$this->get('session')->get('permgroup');
|
||||
if($permgroup=="NO_BODY") throw $this->createNotFoundException('Permission denied');
|
||||
if($permgroup=="ROLE_ANIM" && $this->isGranted('ROLE_USER')) throw $this->createNotFoundException('Permission denied');
|
||||
if($permgroup=="ROLE_MODO" && ($this->isGranted('ROLE_ANIM') || $this->isGranted('ROLE_USER'))) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
// Initialisation de l'enregistrement
|
||||
|
|
|
@ -35,10 +35,14 @@ class RestController extends Controller
|
|||
// key = clé d'accès de l'api
|
||||
// only = paramétre optionnel
|
||||
// only = liste des informations désirés = user, items, bookmarks, groups, alerts, calendars
|
||||
// ssoitems = paramétre optionnel
|
||||
// ssoitems = liste des items issu du ssoitems
|
||||
|
||||
public function userAction($login, Request $request)
|
||||
{
|
||||
$key=$request->get('key');
|
||||
$only=($request->get('only')?explode(",",$request->get('only')):"");
|
||||
$ssoitems=($request->get('ssoitems')?explode(",",$request->get('ssoitems')):"");
|
||||
|
||||
// Vérification de la clé
|
||||
$realkey = $this->getParameter("apikeyninegate");
|
||||
|
@ -73,7 +77,7 @@ class RestController extends Controller
|
|||
$itemcategorys=null;
|
||||
$weburl="https://".$this->getParameter("weburl")."/".$this->getParameter("alias")."/";
|
||||
|
||||
$em->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys,null,4);
|
||||
$em->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys,null,$ssoitems,4);
|
||||
//$this->getDoctrine()->getRepository("CadolesPortalBundle:Page")->getPagesUser($user,null,$entity,$pagesuser,$pagesadmin,$groupsshared);
|
||||
|
||||
// Construction de la réponse
|
||||
|
@ -147,7 +151,7 @@ class RestController extends Controller
|
|||
}
|
||||
|
||||
if($only==""||in_array("alerts",$only)) {
|
||||
$alerts=$em->getRepository("CadolesPortalBundle:Alert")->getUserAlerts($user,null,null);
|
||||
$alerts=$em->getRepository("CadolesPortalBundle:Alert")->getUserAlerts($user,null,null,$ssoitems);
|
||||
foreach($alerts as $alert) {
|
||||
$tmp=[];
|
||||
$tmp["id"] = $alert->getId();
|
||||
|
|
|
@ -40,6 +40,14 @@ class UserController extends Controller
|
|||
|
||||
public function listAction($access)
|
||||
{
|
||||
// Permission
|
||||
if($access=="user") {
|
||||
$permannu=$this->get('session')->get('permannu');
|
||||
if($permannu=="NO_BODY") throw $this->createNotFoundException('Permission denied');
|
||||
if($permannu=="ROLE_ANIM" && $this->isGranted('ROLE_USER')) throw $this->createNotFoundException('Permission denied');
|
||||
if($permannu=="ROLE_MODO" && ($this->isGranted('ROLE_ANIM') || $this->isGranted('ROLE_USER'))) throw $this->createNotFoundException('Permission denied');
|
||||
}
|
||||
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers");
|
||||
$fields=$config->getValue();
|
||||
|
|
|
@ -156,6 +156,7 @@ class ConfigType extends AbstractType
|
|||
"NO_BODY" => "NO_BODY",
|
||||
"ROLE_USER" => "ROLE_USER",
|
||||
"ROLE_ANIM" => "ROLE_ANIM",
|
||||
"ROLE_MODO" => "ROLE_MODO",
|
||||
);
|
||||
|
||||
$builder->add("value", ChoiceType::class,
|
||||
|
|
|
@ -156,7 +156,10 @@ cadoles_core_ajax_group_list:
|
|||
cadoles_core_ajax_group_read:
|
||||
path: /ajax/group/read
|
||||
defaults: { _controller: CadolesCoreBundle:Ajax:groupread }
|
||||
|
||||
|
||||
cadoles_core_ajax_item_list:
|
||||
path: /ajax/item/list
|
||||
defaults: { _controller: CadolesCoreBundle:Ajax:itemlist }
|
||||
|
||||
#== Home Config ==========================================================================================================
|
||||
cadoles_core_config:
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</h1>
|
||||
|
||||
{% set permgroup = app.session.get('permgroup') %}
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_USER" or permgroup=="ROLE_ANIM")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
|
||||
{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permgroup=="ROLE_MODO" or permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
|
||||
<p><a class="btn btn-success" href={{ path('cadoles_core_'~access~'_group_submit') }}>
|
||||
{% if access=="config" %}
|
||||
Ajouter
|
||||
|
|
|
@ -2,7 +2,12 @@
|
|||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') %}
|
||||
<li><a href="{{ path('cadoles_core_config') }}" title="Configuration"><i class="fa fa-cog fa-fw"></i></a>
|
||||
{% endif %}
|
||||
|
||||
{% set permannu = app.session.get('permannu') %}
|
||||
{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permannu=="ROLE_MODO" or permannu=="ROLE_ANIM" or permannu=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permannu=="ROLE_ANIM" or permannu=="ROLE_USER")) or (is_granted('ROLE_USER') and permannu=="ROLE_USER") %}
|
||||
<li id="menu-annuaire"><a href="{{ path('cadoles_core_user_users') }}" title="Annuaire"><i class="fa fa-address-book fa-fw"></i></a>
|
||||
{%endif%}
|
||||
|
||||
<li id="menu-group"><a href="{{ path('cadoles_core_user_group') }}" title="Groupes"><i class="fa fa-users fa-fw"></i></a>
|
||||
<li id="menu-notice"><a href="{{ path('cadoles_portal_user_notice_view') }}" title="Charte"><i class="fa fa-info fa-fw"></i></a>
|
||||
<li id="menu-profil"><a href="{{ path('cadoles_core_user') }}" title="Profil"><img class='avatar' src="/{{ alias }}/uploads/avatar/{{ app.user.avatar }}"></a></li>
|
||||
|
|
|
@ -41,6 +41,13 @@
|
|||
{% else %}
|
||||
{% set bodystyle="simple" %}
|
||||
{% endif %}
|
||||
|
||||
{% if app.user %}
|
||||
{% for usergroup in app.user.groups %}
|
||||
{% set bodystyle = bodystyle~" grp-"~usergroup.group.label|replace({" ":"", "'":""}) %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
<body class="{{ bodystyle }}">
|
||||
<div id="wrapper">
|
||||
{% if useheader and app.request.attributes.get('_route')=='cadoles_core_home' %}
|
||||
|
|
|
@ -67,7 +67,12 @@ class ItemController extends Controller
|
|||
$data = new Item();
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(ItemType::class,$data,array("mode"=>"submit","labelniveau01" => $this->GetParameter("labelsniveau01"),));
|
||||
$form = $this->createForm(ItemType::class,$data,array(
|
||||
"mode" => "submit",
|
||||
"labelniveau01" => $this->GetParameter("labelsniveau01"),
|
||||
"ssosynchroitem" => $this->GetParameter("ssosynchroitem"),
|
||||
"user_attr_cas_item" => $this->GetParameter("user_attr_cas_item")
|
||||
));
|
||||
|
||||
// Récupération des data du formulaire
|
||||
$form->handleRequest($request);
|
||||
|
@ -113,9 +118,11 @@ class ItemController extends Controller
|
|||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(ItemType::class,$data,array(
|
||||
"mode" => "update",
|
||||
"idicon" => ($data->getIcon()?$data->getIcon()->getId():null),
|
||||
"labelniveau01" => $this->GetParameter("labelsniveau01"),
|
||||
"mode" => "update",
|
||||
"idicon" => ($data->getIcon()?$data->getIcon()->getId():null),
|
||||
"labelniveau01" => $this->GetParameter("labelsniveau01"),
|
||||
"ssosynchroitem" => $this->GetParameter("ssosynchroitem"),
|
||||
"user_attr_cas_item" => $this->GetParameter("user_attr_cas_item")
|
||||
));
|
||||
|
||||
// Récupération des data du formulaire
|
||||
|
|
|
@ -599,7 +599,7 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
|
||||
// Profilage
|
||||
$itemsordered = $this->em->getRepository("CadolesPortalBundle:Item")->getUserItems($this->user,$bookmarks,$items,$itemcategorys,$iditemcategory,$withbookmark,false);
|
||||
$itemsordered = $this->em->getRepository("CadolesPortalBundle:Item")->getUserItems($this->user,$bookmarks,$items,$itemcategorys,$iditemcategory,$this->get('session')->get('ssoitems'),$withbookmark,false);
|
||||
}
|
||||
|
||||
// Render
|
||||
|
@ -637,7 +637,7 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
|
||||
// Profilage
|
||||
$itemsordered = $this->em->getRepository("CadolesPortalBundle:Item")->getUserItems($this->user,$bookmarks,$items,$itemcategorys,null,0,true);
|
||||
$itemsordered = $this->em->getRepository("CadolesPortalBundle:Item")->getUserItems($this->user,$bookmarks,$items,$itemcategorys,null,$this->get('session')->get('ssoitems'),0,true);
|
||||
}
|
||||
|
||||
// Render
|
||||
|
@ -671,7 +671,7 @@ class PagewidgetController extends Controller
|
|||
}
|
||||
|
||||
// Profilage
|
||||
$alertsordered=$this->em->getRepository("CadolesPortalBundle:Alert")->getUserAlerts($this->user,$idalertcategory,$alertcategoryfilter);
|
||||
$alertsordered=$this->em->getRepository("CadolesPortalBundle:Alert")->getUserAlerts($this->user,$idalertcategory,$alertcategoryfilter,$this->get('session')->get('ssoitems'));
|
||||
}
|
||||
|
||||
// Render
|
||||
|
|
|
@ -105,6 +105,15 @@ class Alert
|
|||
*/
|
||||
protected $readers;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Item", inversedBy="alerts", cascade={"persist"})
|
||||
* @ORM\JoinTable(name="alertitem",
|
||||
* joinColumns={@ORM\JoinColumn(name="alert", referencedColumnName="id")},
|
||||
* inverseJoinColumns={@ORM\JoinColumn(name="item", referencedColumnName="id")}
|
||||
* )
|
||||
*/
|
||||
protected $items;
|
||||
|
||||
// Is Online
|
||||
public function isOnline()
|
||||
{
|
||||
|
@ -461,4 +470,38 @@ class Alert
|
|||
{
|
||||
return $this->readers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add item
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Item $item
|
||||
*
|
||||
* @return Alert
|
||||
*/
|
||||
public function addItem(\Cadoles\PortalBundle\Entity\Item $item)
|
||||
{
|
||||
$this->items[] = $item;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove item
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Item $item
|
||||
*/
|
||||
public function removeItem(\Cadoles\PortalBundle\Entity\Item $item)
|
||||
{
|
||||
$this->items->removeElement($item);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get items
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,13 @@ class Item
|
|||
*/
|
||||
private $roles;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @ORM\Column(name="ssoitem", type="string", nullable=true)
|
||||
*/
|
||||
private $ssoitem;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Icon", inversedBy="items")
|
||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL")
|
||||
|
@ -140,6 +147,11 @@ class Item
|
|||
*/
|
||||
protected $niveau01s;
|
||||
|
||||
/**
|
||||
* @ORM\ManyToMany(targetEntity="Cadoles\PortalBundle\Entity\Alert", mappedBy="items")
|
||||
*/
|
||||
protected $alerts;
|
||||
|
||||
// A garder pour forcer l'id en init
|
||||
public function setId($id)
|
||||
{
|
||||
|
@ -580,4 +592,62 @@ class Item
|
|||
{
|
||||
return $this->essential;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add alert
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Alert $alert
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public function addAlert(\Cadoles\PortalBundle\Entity\Alert $alert)
|
||||
{
|
||||
$this->alerts[] = $alert;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove alert
|
||||
*
|
||||
* @param \Cadoles\PortalBundle\Entity\Alert $alert
|
||||
*/
|
||||
public function removeAlert(\Cadoles\PortalBundle\Entity\Alert $alert)
|
||||
{
|
||||
$this->alerts->removeElement($alert);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get alerts
|
||||
*
|
||||
* @return \Doctrine\Common\Collections\Collection
|
||||
*/
|
||||
public function getAlerts()
|
||||
{
|
||||
return $this->alerts;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set ssoitem
|
||||
*
|
||||
* @param string $ssoitem
|
||||
*
|
||||
* @return Item
|
||||
*/
|
||||
public function setSsoitem($ssoitem)
|
||||
{
|
||||
$this->ssoitem = $ssoitem;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get ssoitem
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSsoitem()
|
||||
{
|
||||
return $this->ssoitem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,6 +98,24 @@ class AlertType extends AbstractType
|
|||
'placeholder' => 'Selectionner un groupe',
|
||||
])
|
||||
|
||||
->add('items', Select2EntityType::class, [
|
||||
'label' => 'Visible pour les Items',
|
||||
'class' => 'CadolesPortalBundle:Item',
|
||||
'text_property' => 'label',
|
||||
'multiple' => true,
|
||||
'remote_route' => 'cadoles_core_ajax_item_list',
|
||||
'primary_key' => 'id',
|
||||
'text_property' => 'title',
|
||||
'minimum_input_length' => 0,
|
||||
'page_limit' => 100,
|
||||
'allow_clear' => true,
|
||||
'delay' => 250,
|
||||
'cache' => false,
|
||||
'cache_timeout' => 60000,
|
||||
'language' => 'fr',
|
||||
'placeholder' => 'Selectionner des items',
|
||||
])
|
||||
|
||||
->add('publishedat', DateType::class, [
|
||||
'label' => 'Publier du',
|
||||
'input' => 'datetime',
|
||||
|
|
|
@ -133,6 +133,13 @@ class ItemType extends AbstractType
|
|||
])
|
||||
|
||||
->add('idicon', HiddenType::class,['mapped'=> false,'data' => $options["idicon"]]);
|
||||
|
||||
if($options["ssosynchroitem"]) {
|
||||
$builder->add("ssoitem", TextType::class, [
|
||||
"label" => "Visible si attribut SSO ".$options["user_attr_cas_item"]." égale à",
|
||||
"disabled" => ($options["mode"]=="delete"?true:false),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
|
@ -142,6 +149,8 @@ class ItemType extends AbstractType
|
|||
'mode' => "string",
|
||||
'idicon' => "string",
|
||||
'labelniveau01' => "string",
|
||||
'ssosynchroitem' => "string",
|
||||
'user_attr_cas_item' => "string",
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,12 +40,12 @@ class AlertRepository extends EntityRepository
|
|||
;
|
||||
}
|
||||
|
||||
public function getUserAlerts($user,$idalertcategory,$alertcategoryfilter) {
|
||||
public function getUserAlerts($user,$idalertcategory,$alertcategoryfilter,$ssoitems) {
|
||||
// Profilage
|
||||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$niveau01=($user?$user->getNiveau01():null);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
||||
|
||||
// Initialisation du calcul des alerts
|
||||
$alerts=new ArrayCollection();
|
||||
|
||||
|
@ -118,6 +118,34 @@ class AlertRepository extends EntityRepository
|
|||
}
|
||||
}
|
||||
|
||||
// Récupération des alerts par item
|
||||
$bookmarks=null;
|
||||
$items=null;
|
||||
$itemcategorys=null;
|
||||
$this->getEntityManager()->getRepository("CadolesPortalBundle:Item")->getUserItems($user,$bookmarks,$items,$itemcategorys,null,$ssoitems,4);
|
||||
foreach($items as $item) {
|
||||
$qb = $this->createQueryBuilder('a');
|
||||
$qb->select('alert')
|
||||
->from("CadolesPortalBundle:Alert", 'alert')
|
||||
->where(":item MEMBER OF alert.items")
|
||||
->andWhere('alert.publishedat <= :today')
|
||||
->andWhere($qb->expr()->orX(
|
||||
$qb->expr()->gt('alert.unpublishedat', ':today'),
|
||||
$qb->expr()->isNull('alert.unpublishedat')
|
||||
))
|
||||
->setParameter("item",$item)
|
||||
->setParameter('today', date('Y-m-d'));
|
||||
|
||||
if($idalertcategory && $alertcategoryfilter) {
|
||||
$qb->andWhere("alert.alertcategory=:alertcategory")
|
||||
->setParameter("alertcategory",$alertcategoryfilter);
|
||||
}
|
||||
$alertsitems=$qb->getQuery()->getResult();
|
||||
foreach($alertsitems as $alertitem) {
|
||||
if(!$alerts->contains($alertitem)&&!$alertitem->getReaders()->contains($user)) $alerts->add($alertitem);
|
||||
}
|
||||
}
|
||||
|
||||
// Trie des alerts
|
||||
$alertsordered = $alerts->getIterator();
|
||||
$alertsordered->uasort(function ($first, $second) {
|
||||
|
|
|
@ -7,7 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
|
||||
class ItemRepository extends EntityRepository
|
||||
{
|
||||
public function getUserItems($user,&$bookmarks,&$itemsordered,&$itemcategorys,$iditemcategory=null,$withbookmark=1,$fgessential=false) {
|
||||
public function getUserItems($user,&$bookmarks,&$itemsordered,&$itemcategorys,$iditemcategory=null,$ssoitems,$withbookmark=1,$fgessential=false) {
|
||||
// Profilage
|
||||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
@ -106,6 +106,31 @@ class ItemRepository extends EntityRepository
|
|||
}
|
||||
}
|
||||
|
||||
// Récupération des items par ssoitem
|
||||
foreach($ssoitems as $ssoitem) {
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('item')
|
||||
->from("CadolesPortalBundle:Item", 'item')
|
||||
->where("item.ssoitem=:ssoitem ")
|
||||
->setParameter("ssoitem",$ssoitem);
|
||||
|
||||
if($iditemcategory && $itemcategoryfilter) {
|
||||
$qb->andWhere("item.itemcategory=:itemcategory")
|
||||
->setParameter("itemcategory",$itemcategoryfilter);
|
||||
}
|
||||
|
||||
if($fgessential) {
|
||||
$qb->andWhere("item.essential=:flag")
|
||||
->setParameter("flag",true);
|
||||
}
|
||||
|
||||
$itemsssoitems=$qb->getQuery()->getResult();
|
||||
|
||||
foreach($itemsssoitems as $itemssoitem) {
|
||||
if(!$bookmarksitems->contains($itemssoitem) && !$items->contains($itemssoitem)) $items->add($itemssoitem);
|
||||
}
|
||||
}
|
||||
|
||||
// Trie des items
|
||||
$itemsordered = $items->getIterator();
|
||||
$itemsordered->uasort(function ($first, $second) {
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
{{ form_row(form.roles) }}
|
||||
{{ form_row(form.niveau01s) }}
|
||||
{{ form_row(form.groups) }}
|
||||
{{ form_row(form.items) }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -61,6 +61,10 @@
|
|||
{{ form_row(form.roles) }}
|
||||
{{ form_row(form.niveau01s) }}
|
||||
{{ form_row(form.groups) }}
|
||||
{% if form.ssoitem is defined %}
|
||||
{{ form_row(form.ssoitem) }}
|
||||
{% endif %}
|
||||
|
||||
{{ form_row(form.color) }}
|
||||
|
||||
<div id="diviconsel" class="col-md-12 text-left" style="height:140px; padding:20px; text-align:center; background-color: {{ item.color ? "#"~item.color : '#'~color['main'] }};">
|
||||
|
|
|
@ -69,6 +69,64 @@
|
|||
|
||||
<div class="panel-body">
|
||||
{{ alert.content|raw }}
|
||||
|
||||
{% if not alert.items is empty %}
|
||||
{% if app.user %}
|
||||
{% set username = app.user.username %}
|
||||
{% else %}
|
||||
{% set username = "" %}
|
||||
{% endif %}
|
||||
|
||||
<div class="grid clearfix fitWidth" style="width:auto; margin: 0 auto;">
|
||||
<div class="grid-sizer grid-small"></div>
|
||||
<div class="grid-gutter-sizer"></div>
|
||||
|
||||
{% for item in alert.items %}
|
||||
<div class="grid-item grid-list">
|
||||
<div class="grid-item-content" style="background-color: {{ item.color ? "#"~item.color : '#'~colormain }};">
|
||||
{% if item.protected and not app.user %}
|
||||
{% if mode_auth == "SAML" %}
|
||||
<a href="{{ path('lightsaml_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
|
||||
{% elseif mode_auth == "CAS" %}
|
||||
<a href="{{ path('cas_sp.login') }}" {% if access=="user" %}target="_top"{% endif %}>
|
||||
{% elseif mode_auth == "MYSQL" %}
|
||||
<a href="{{ path('cnous_portal_user_login') }}" {% if access=="user" %}target="_top"{% endif %}>
|
||||
{% endif %}
|
||||
|
||||
{% else %}
|
||||
{% if item.target == 'frame' %}
|
||||
<a class="linktosonde" data-sonde="{{ item.title }}" style="cursor:pointer" onClick="showFrameitem({{ item.id }},'{{ item.url|replace({'#login#': username}) }}')">
|
||||
{% elseif item.target == "_self" %}
|
||||
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{% if access=="user" %}_top{% else %}{{ item.target }}{% endif %}">
|
||||
{% else %}
|
||||
<a class="linktosonde" data-sonde="{{ item.title }}" href="{{ item.url|replace({'#login#': username}) }}" target="{{ item.target }}">
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
<div class="item-link clearfix">
|
||||
<div class="grid-item-logo" title="{{ item.subtitle|nl2br }}">
|
||||
{% if item.icon %}
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/{{ item.icon.label }}">
|
||||
{% else %}
|
||||
<img class="grid-item-img" height="110" src="/{{ alias }}/uploads/icon/icon_pin.png">
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="grid-item-title">
|
||||
<h2>{{ item.title }}</h2>
|
||||
<span>{{ item.subtitle|nl2br }}</<span>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
<div class="grid-item-body" style="display:none">
|
||||
{{ item.content|raw }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
{% set permgroup = app.session.get('permgroup') %}
|
||||
{% set canadd = false %}
|
||||
{% if is_granted('ROLE_ADMIN') or is_granted('ROLE_MODO') or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ADMIN" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
|
||||
{% if is_granted('ROLE_ADMIN') or (is_granted('ROLE_MODO') and (permgroup=="ROLE_MODO" or permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_ANIM') and (permgroup=="ROLE_ANIM" or permgroup=="ROLE_USER")) or (is_granted('ROLE_USER') and permgroup=="ROLE_USER") %}
|
||||
{% set canadd = true %}
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -119,6 +119,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
|
|||
('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy'),
|
||||
%end if
|
||||
|
||||
('500', 1, 1, 1, 'permgroup', 'permgroup', 'ROLE_ANIM', '', 'Determine quel rôle aura la permission de créer des groupes de travail');
|
||||
('500', 1, 1, 1, 'permgroup', 'permgroup', 'ROLE_ANIM', '', 'Determine quel rôle aura la permission de créer des groupes de travail'),
|
||||
('501', 1, 1, 1, 'permgroup', 'permannu', 'ROLE_USER', '', 'Determine quel rôle aura la permission de voir l\'annuaire');
|
||||
|
||||
|
||||
|
|
|
@ -495,10 +495,18 @@ parameters:
|
|||
ssosynchrogroup: true
|
||||
user_attr_cas_group: %%ninegate_ssoreqgroup
|
||||
%else
|
||||
ssosynchrogroup: fase
|
||||
ssosynchrogroup: false
|
||||
user_attr_cas_group:
|
||||
%end if
|
||||
|
||||
%if %%getVar("ninegate_ssosynchroitem", 'non') == "oui"
|
||||
ssosynchroitem: true
|
||||
user_attr_cas_item: %%ninegate_ssoreqitem
|
||||
%else
|
||||
ssosynchroitem: false
|
||||
user_attr_cas_item:
|
||||
%end if
|
||||
|
||||
%if %%is_defined("ninegate_smtpport")
|
||||
mailer_port: '%%ninegate_smtpport'
|
||||
mailer_encryption: %%ninegate_smtpencryption
|
||||
|
|
Loading…
Reference in New Issue