Project

General

Profile

Revision 9b5ab541

ID9b5ab541f4634f6c4e4ab3dc7cc0bf5e37fa643b
Parent b6d2af46
Child 8cc57aa8

Added by Francois POIROTTE over 13 years ago

Correction d'un des tests unitaires sur la recherche.
Correction d'un bug dans la gestion des permissions dans la recherche.

git-svn-id: https://vigilo-dev.si.c-s.fr/svn@5134 b22e2e97-25c9-44ff-b637-2e5ceca36478

View differences:

vigigraph/controllers/rpc.py
164 164
        if not is_manager:
165 165
            supitemgroups = [sig[0] for sig in user.supitemgroups() if sig[1]]
166 166
            # pylint: disable-msg=E1103
167
            items = items.filter(
168
                SUPITEM_GROUP_TABLE.c.idgroup.in_(supitemgroups))
167
            items = items.join(
168
                (GroupHierarchy, GroupHierarchy.idchild == \
169
                    SUPITEM_GROUP_TABLE.c.idgroup)
170
            ).filter(GroupHierarchy.idparent.in_(supitemgroups))
169 171

  
170 172
        items = items.limit(100).all() # pylint: disable-msg=E1103
171 173
        if not search_form_graph:
......
174 176
        else:
175 177
            ids = [(item.idhost, item.idgraph) for item in items]
176 178
            labels = [(item.hostname, item.graphname) for item in items]
179

  
177 180
        return dict(labels=labels, ids=ids)
178 181

  
179 182
    @expose('graphslist.html')
......
650 653

  
651 654
        return dict(groups = groups, leaves=[])
652 655

  
653
#    def get_root_graph_groups(self, host_id):
654
#        """
655
#        Retourne tous les groupes racines (c'est à dire n'ayant
656
#        aucun parent) de graphes auquel l'utilisateur a accès et
657
#        concernant l'hôte dont l'identifiant est passé en paramètre.
658
#
659
#        @return: Un dictionnaire contenant la liste de ces groupes.
660
#        @rtype : C{dict} of C{list} of C{dict} of C{mixed}
661
#        """
662
#
663
#        # On récupère tous les groupes qui ont un parent.
664
#        children = DBSession.query(
665
#            Graph,
666
#        ).distinct(
667
#        ).join(
668
#            (GroupHierarchy, GroupHierarchy.idchild == SupItemGroup.idgroup)
669
#        ).filter(GroupHierarchy.hops > 0)
670
#
671
#        # On récupère tous les groupes racines de graphes portant sur l'hôte
672
#        # souhaité, en éliminant les groupes récupérés à l'étape précédente
673
#        graph_groups = DBSession.query(
674
#            GraphGroup
675
#        ).distinct(
676
#        ).join(
677
#            (GRAPH_GROUP_TABLE, \
678
#                GRAPH_GROUP_TABLE.c.idgroup == GraphGroup.idgroup),
679
#            (Graph, Graph.idgraph == GRAPH_GROUP_TABLE.c.idgraph),
680
#            (GRAPH_PERFDATASOURCE_TABLE, \
681
#                    GRAPH_PERFDATASOURCE_TABLE.c.idgraph == Graph.idgraph),
682
#            (PerfDataSource, PerfDataSource.idperfdatasource == \
683
#                    GRAPH_PERFDATASOURCE_TABLE.c.idperfdatasource),
684
#            (SUPITEM_GROUP_TABLE, \
685
#                SUPITEM_GROUP_TABLE.c.idsupitem == PerfDataSource.idhost),
686
#        ).filter(PerfDataSource.idhost == host_id
687
##        ).except_(children
688
#        ).order_by(GraphGroup.name.asc())
689
#
690
#        # On filtre ces groupes racines afin de ne
691
#        # retourner que ceux auquels l'utilisateur a accès
692
#        user = get_current_user()
693
#        is_manager = in_group('managers').is_met(request.environ)
694
#        if not is_manager:
695
#            user_groups = [ug[0] for ug in user.supitemgroups() if ug[1]]
696
#            graph_groups = graph_groups.filter(
697
#                SUPITEM_GROUP_TABLE.c.idgroup.in_(user_groups))
698
#
699
#        groups = []
700
#        for group in graph_groups.all():
701
#            #if group.has_children() or len(group.graphs)>0:
702
#            groups.append({
703
#                'id'   : group.idgroup,
704
#                'name' : group.name,
705
#            })
706
#
707
#        return dict(groups = groups, graphs=[])
708

  
709 656
    def getListIndicators(self, host, graph):
710 657
        """
711 658
        Liste d indicateurs associes a un graphe
......
733 680
                ).filter(Host.name == host
734 681
                ).all()
735 682
        return indicators
736

  
vigigraph/tests/functional/test_search_form.py
359 359
        # Récupération des résultats obtenus après une recherche
360 360
        # sur le graphe 'graph2' pour l'utilisateur 'poweruser'
361 361
        response = self.app.post(
362
        '/rpc/searchHostAndGraph?search_form_host=%s&search_form_host=%s' %
362
        '/rpc/searchHostAndGraph?search_form_host=%s&search_form_graph=%s' %
363 363
            (str(host2.name), str(graph2.name)), {
364 364
            }, extra_environ={'REMOTE_USER': 'poweruser'})
365 365
        json = response.json

Also available in: Unified diff