cacher les groupes aux users (fixes #32271)
This commit is contained in:
parent
2a2dfc55bb
commit
465bfd0374
|
@ -326,10 +326,9 @@ class ConfigController extends Controller
|
||||||
$fields["niveau02"]["perm"]=1;
|
$fields["niveau02"]["perm"]=1;
|
||||||
$fields["niveau02"]["label"]=$session->get('labelniveau02');
|
$fields["niveau02"]["label"]=$session->get('labelniveau02');
|
||||||
}
|
}
|
||||||
if(!array_key_exists("group",$fields)) {
|
if(!array_key_exists("group",$fields)) $fields["group"]["perm"]=1;
|
||||||
$fields["group"]["perm"]=1;
|
$fields["group"]["label"]="Groupes (caché uniquement pour le rôle Utilisateur) ";
|
||||||
$fields["group"]["label"]="Groupes";
|
|
||||||
}
|
|
||||||
if(!array_key_exists("job",$fields)) {
|
if(!array_key_exists("job",$fields)) {
|
||||||
$fields["job"]["perm"]=1;
|
$fields["job"]["perm"]=1;
|
||||||
$fields["job"]["label"]="Métier";
|
$fields["job"]["label"]="Métier";
|
||||||
|
@ -346,10 +345,8 @@ class ConfigController extends Controller
|
||||||
$fields["telephonenumber"]["perm"]=1;
|
$fields["telephonenumber"]["perm"]=1;
|
||||||
$fields["telephonenumber"]["label"]="Téléphone";
|
$fields["telephonenumber"]["label"]="Téléphone";
|
||||||
}
|
}
|
||||||
if(!array_key_exists("visitedate",$fields)) {
|
if(!array_key_exists("visitedate",$fields)) $fields["visitedate"]["perm"]=1;
|
||||||
$fields["visitedate"]["perm"]=1;
|
$fields["visitedate"]["label"]="Visite (caché uniquement pour les rôles Animateur et Utilisateur) ";
|
||||||
$fields["visitedate"]["label"]="Visite";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$session->get('viewniveau02'))
|
if(!$session->get('viewniveau02'))
|
||||||
unset($fields["niveau02"]);
|
unset($fields["niveau02"]);
|
||||||
|
|
|
@ -842,7 +842,7 @@ class UserController extends Controller
|
||||||
public function viewAction($id, Request $request)
|
public function viewAction($id, Request $request)
|
||||||
{
|
{
|
||||||
$user=$this->getData($id);
|
$user=$this->getData($id);
|
||||||
$fields=$this->getDefaultDatauser();
|
$fields=$this->getDefaultDatausers();
|
||||||
|
|
||||||
return $this->render('CadolesCoreBundle:User:view.html.twig', [
|
return $this->render('CadolesCoreBundle:User:view.html.twig', [
|
||||||
'useheader' => false,
|
'useheader' => false,
|
||||||
|
@ -1456,7 +1456,76 @@ class UserController extends Controller
|
||||||
if(!array_key_exists("visite",$fields)) {
|
if(!array_key_exists("visite",$fields)) {
|
||||||
$fields["visite"]["perm"]=1;
|
$fields["visite"]["perm"]=1;
|
||||||
$fields["visite"]["label"]="Visite";
|
$fields["visite"]["label"]="Visite";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return $fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getDefaultDatausers()
|
||||||
|
{
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$session=$this->get('session');
|
||||||
|
$config=$em->getRepository('CadolesCoreBundle:Config')->find("datausers");
|
||||||
|
$fields=$config->getValue();
|
||||||
|
|
||||||
|
$fields=json_decode($fields, true);
|
||||||
|
if(!is_array($fields)) $fields=[];
|
||||||
|
|
||||||
|
// Valeur par défaut 0=caché / 3=visible
|
||||||
|
if(!array_key_exists("avatar",$fields)) {
|
||||||
|
$fields["avatar"]["perm"]=1;
|
||||||
|
$fields["avatar"]["label"]="Avatar";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("login",$fields)) {
|
||||||
|
$fields["login"]["perm"]=1;
|
||||||
|
$fields["login"]["label"]="Login";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("lastname",$fields)) {
|
||||||
|
$fields["lastname"]["perm"]=1;
|
||||||
|
$fields["lastname"]["label"]="Nom";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("firstname",$fields)) {
|
||||||
|
$fields["firstname"]["perm"]=1;
|
||||||
|
$fields["firstname"]["label"]="Prenom";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("email",$fields)) {
|
||||||
|
$fields["email"]["perm"]=1;
|
||||||
|
$fields["email"]["label"]="Email";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("niveau01",$fields)) {
|
||||||
|
$fields["niveau01"]["perm"]=1;
|
||||||
|
$fields["niveau01"]["label"]=$session->get('labelniveau01');
|
||||||
}
|
}
|
||||||
|
if(!array_key_exists("niveau02",$fields)) {
|
||||||
|
$fields["niveau02"]["perm"]=1;
|
||||||
|
$fields["niveau02"]["label"]=$session->get('labelniveau02');
|
||||||
|
}
|
||||||
|
if(!array_key_exists("group",$fields)) $fields["group"]["perm"]=1;
|
||||||
|
$fields["group"]["label"]="Groupes (caché uniquement pour le rôle Utilisateur) ";
|
||||||
|
|
||||||
|
if(!array_key_exists("job",$fields)) {
|
||||||
|
$fields["job"]["perm"]=1;
|
||||||
|
$fields["job"]["label"]="Métier";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("position",$fields)) {
|
||||||
|
$fields["position"]["perm"]=1;
|
||||||
|
$fields["position"]["label"]="Fonction";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("role",$fields)) {
|
||||||
|
$fields["role"]["perm"]=1;
|
||||||
|
$fields["role"]["label"]="Rôles";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("telephonenumber",$fields)) {
|
||||||
|
$fields["telephonenumber"]["perm"]=1;
|
||||||
|
$fields["telephonenumber"]["label"]="Téléphone";
|
||||||
|
}
|
||||||
|
if(!array_key_exists("visitedate",$fields)) $fields["visitedate"]["perm"]=1;
|
||||||
|
$fields["visitedate"]["label"]="Visite (caché uniquement pour les rôles Animateur et Utilisateur) ";
|
||||||
|
|
||||||
|
if(!$session->get('viewniveau02'))
|
||||||
|
unset($fields["niveau02"]);
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,10 @@ td { font-size: 10px; }
|
||||||
{% if viewniveau02 %}
|
{% if viewniveau02 %}
|
||||||
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
|
<th class="no-sort {% if fields["niveau02"] is defined and fields["niveau02"].perm==0 %}no-visible{% endif %}">{{ labelniveau02 }}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 %}no-visible{% endif %}">Groupes</th>
|
<th class="no-sort {% if fields["group"] is defined and fields["group"].perm==0 and is_granted('ROLE_USER') %}no-visible{% endif %}">Groupes</th>
|
||||||
<th class="{% if fields["job"] is defined and fields["job"].perm==0 %}no-visible{% endif %}">Métier</th>
|
<th class="{% if fields["job"] is defined and fields["job"].perm==0 %}no-visible{% endif %}">Métier</th>
|
||||||
<th class="{% if fields["position"] is defined and fields["position"].perm==0 %}no-visible{% endif %}">Fonction</th>
|
<th class="{% if fields["position"] is defined and fields["position"].perm==0 %}no-visible{% endif %}">Fonction</th>
|
||||||
<th class="{% if fields["visitedate"] is defined and fields["visitedate"].perm==0 %}no-visible{% endif %}">Visite</th>
|
<th class="{% if fields["visitedate"] is defined and fields["visitedate"].perm==0 and (is_granted('ROLE_USER') or is_granted('ROLE_ANIM')) %}no-visible{% endif %}">Visite</th>
|
||||||
<th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
|
<th class="{% if fields["role"] is defined and fields["role"].perm==0 %}no-visible{% endif %}">Rôle</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
|
@ -19,20 +19,24 @@
|
||||||
{%if user.job and not fields["job"]["perm"]==0 %}<b>{{fields["position"]["job"]}}</b> = {{ user.job }}<br>{%endif%}
|
{%if user.job and not fields["job"]["perm"]==0 %}<b>{{fields["position"]["job"]}}</b> = {{ user.job }}<br>{%endif%}
|
||||||
{%if user.position and not fields["position"]["perm"]==0 %}<b>{{fields["position"]["label"]}}</b> = {{ user.position }}<br>{%endif%}
|
{%if user.position and not fields["position"]["perm"]==0 %}<b>{{fields["position"]["label"]}}</b> = {{ user.position }}<br>{%endif%}
|
||||||
{%if user.postaladress and not fields["postaladress"]["perm"]==0 %}<b>{{fields["postaladress"]["label"]}}</b> = {{ user.postaladress }}<br>{%endif%}
|
{%if user.postaladress and not fields["postaladress"]["perm"]==0 %}<b>{{fields["postaladress"]["label"]}}</b> = {{ user.postaladress }}<br>{%endif%}
|
||||||
{%if user.visitedate and not fields["visite"]["perm"]==0 %}<b>Date de dernière visite</b> = {{ user.visitedate|date('d/m/Y H:i') }}<br>{%endif%}
|
|
||||||
{%if user.visitecpt and not fields["visite"]["perm"]==0 %}<b>Nombre de visites</b> = {{ user.visitecpt }}<br>{%endif%}
|
{%if user.visitedate and (not fields["visitedate"]["perm"]==0 or (not is_granted('ROLE_USER') and not is_granted('ROLE_ANIM'))) %}<b>Date de dernière visite</b> = {{ user.visitedate|date('d/m/Y H:i') }}<br>{%endif%}
|
||||||
<br>
|
{%if user.visitecpt and (not fields["visitedate"]["perm"]==0 or (not is_granted('ROLE_USER') and not is_granted('ROLE_ANIM'))) %}<b>Nombre de visites</b> = {{ user.visitecpt }}<br>{%endif%}
|
||||||
{% set fgtitle=false %}
|
|
||||||
{% for usergroup in user.groups %}
|
{% if not fields["group"].perm==0 or not is_granted('ROLE_USER') %}
|
||||||
{% if usergroup.group.fgcanshare %}
|
<br>
|
||||||
{% if not fgtitle %}
|
{% set fgtitle=false %}
|
||||||
<br><b>Groupes de Travail</b><br>
|
{% for usergroup in user.groups %}
|
||||||
{% set fgtitle=true %}
|
{% if usergroup.group.fgcanshare %}
|
||||||
|
{% if not fgtitle %}
|
||||||
|
<br><b>Groupes de Travail</b><br>
|
||||||
|
{% set fgtitle=true %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{{ usergroup.group.label }}<br>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
{{ usergroup.group.label }}<br>
|
{% endif %}
|
||||||
{% endif %}
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1026,15 +1026,15 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
//== WIDGET ============================================================================================================================================
|
//== WIDGET ============================================================================================================================================
|
||||||
$output->writeln(' > Creation Widget');
|
$output->writeln(' > Creation Widget');
|
||||||
|
|
||||||
// Widget URL
|
// Widget Page web
|
||||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-2000);
|
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-2000);
|
||||||
if(!$entityWidget) $entityWidget = new Widget();
|
if(!$entityWidget) $entityWidget = new Widget();
|
||||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_ribbon.png"]);
|
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_ribbon.png"]);
|
||||||
$entityWidget->setId(-2000);
|
$entityWidget->setId(-2000);
|
||||||
$entityWidget->setRoworder(0);
|
$entityWidget->setRoworder(0);
|
||||||
$entityWidget->setIcon($entityicon);
|
$entityWidget->setIcon($entityicon);
|
||||||
$entityWidget->setName('URL');
|
$entityWidget->setName('Page web');
|
||||||
$entityWidget->setDescription("Affiche le contenu d'une url");
|
$entityWidget->setDescription("Affiche le contenu d'une page web");
|
||||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_url");
|
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_url");
|
||||||
$entityWidget->setHeight("630");
|
$entityWidget->setHeight("630");
|
||||||
$entityWidget->setAutoajust(false);
|
$entityWidget->setAutoajust(false);
|
||||||
|
@ -1106,15 +1106,15 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
$em->persist($entityWidget);
|
$em->persist($entityWidget);
|
||||||
|
|
||||||
|
|
||||||
// Widget Favoris
|
// Widget Liens
|
||||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1960);
|
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1960);
|
||||||
if(!$entityWidget) $entityWidget = new Widget();
|
if(!$entityWidget) $entityWidget = new Widget();
|
||||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_star.png"]);
|
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_star.png"]);
|
||||||
$entityWidget->setId(-1960);
|
$entityWidget->setId(-1960);
|
||||||
$entityWidget->setRoworder(0);
|
$entityWidget->setRoworder(0);
|
||||||
$entityWidget->setIcon($entityicon);
|
$entityWidget->setIcon($entityicon);
|
||||||
$entityWidget->setName('Favoris');
|
$entityWidget->setName('Liens');
|
||||||
$entityWidget->setDescription("Création de Favoris");
|
$entityWidget->setDescription("Bibliothèque de Liens");
|
||||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_bookmark");
|
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_bookmark");
|
||||||
$entityWidget->setHeight("630");
|
$entityWidget->setHeight("630");
|
||||||
$entityWidget->setAutoajust(true);
|
$entityWidget->setAutoajust(true);
|
||||||
|
@ -1126,7 +1126,7 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
$em->persist($entityWidget);
|
$em->persist($entityWidget);
|
||||||
|
|
||||||
|
|
||||||
// Widget Liens
|
// Widget Lien
|
||||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1950);
|
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1950);
|
||||||
if(!$entityWidget) $entityWidget = new Widget();
|
if(!$entityWidget) $entityWidget = new Widget();
|
||||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_bolt.png"]);
|
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_bolt.png"]);
|
||||||
|
@ -1134,7 +1134,7 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
$entityWidget->setRoworder(0);
|
$entityWidget->setRoworder(0);
|
||||||
$entityWidget->setIcon($entityicon);
|
$entityWidget->setIcon($entityicon);
|
||||||
$entityWidget->setName('Lien');
|
$entityWidget->setName('Lien');
|
||||||
$entityWidget->setDescription("Création d'un Lien");
|
$entityWidget->setDescription("Création d'un Lien unique");
|
||||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_link");
|
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_link");
|
||||||
$entityWidget->setHeight("200");
|
$entityWidget->setHeight("200");
|
||||||
$entityWidget->setAutoajust(true);
|
$entityWidget->setAutoajust(true);
|
||||||
|
@ -1146,14 +1146,14 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
$em->persist($entityWidget);
|
$em->persist($entityWidget);
|
||||||
|
|
||||||
|
|
||||||
// Widget Editor
|
// Widget Texte
|
||||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1940);
|
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1940);
|
||||||
if(!$entityWidget) $entityWidget = new Widget();
|
if(!$entityWidget) $entityWidget = new Widget();
|
||||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]);
|
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_compose.png"]);
|
||||||
$entityWidget->setId(-1940);
|
$entityWidget->setId(-1940);
|
||||||
$entityWidget->setRoworder(0);
|
$entityWidget->setRoworder(0);
|
||||||
$entityWidget->setIcon($entityicon);
|
$entityWidget->setIcon($entityicon);
|
||||||
$entityWidget->setName('Editeur');
|
$entityWidget->setName('Texte');
|
||||||
$entityWidget->setDescription("Votre propre texte à éditer");
|
$entityWidget->setDescription("Votre propre texte à éditer");
|
||||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_editor");
|
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_editor");
|
||||||
$entityWidget->setHeight("630");
|
$entityWidget->setHeight("630");
|
||||||
|
@ -1317,14 +1317,14 @@ class InitDataCommand extends ContainerAwareCommand
|
||||||
$em->persist($entityWidget);
|
$em->persist($entityWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget Information
|
// Widget Informations
|
||||||
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1860);
|
$entityWidget = $em->getRepository('CadolesPortalBundle:Widget')->find(-1860);
|
||||||
if(!$entityWidget) $entityWidget = new Widget();
|
if(!$entityWidget) $entityWidget = new Widget();
|
||||||
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_info.png"]);
|
$entityicon = $em->getRepository('CadolesPortalBundle:Icon')->findoneby(["label"=>"uploads/icon/icon_info.png"]);
|
||||||
$entityWidget->setId(-1860);
|
$entityWidget->setId(-1860);
|
||||||
$entityWidget->setRoworder(0);
|
$entityWidget->setRoworder(0);
|
||||||
$entityWidget->setIcon($entityicon);
|
$entityWidget->setIcon($entityicon);
|
||||||
$entityWidget->setName('Information Page');
|
$entityWidget->setName('Informations');
|
||||||
$entityWidget->setDescription("Afficher les informations associées à la page");
|
$entityWidget->setDescription("Afficher les informations associées à la page");
|
||||||
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_info");
|
$entityWidget->setRouteview("cadoles_portal_config_panelwidget_view_info");
|
||||||
$entityWidget->setHeight("630");
|
$entityWidget->setHeight("630");
|
||||||
|
|
Loading…
Reference in New Issue