Revision 7e984955
Suite de la r7302 :
- Mise à jour des tests unitaires ;
- Corrections des bugs rencontrés.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@7304 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigigraph/controllers/rpc.py | ||
---|---|---|
351 | 351 |
if not is_manager: |
352 | 352 |
# Récupération des groupes auxquels l'utilisateur a accès. |
353 | 353 |
supitemgroups = [sig[0] for sig in user.supitemgroups() if sig[1]] |
354 |
# Si aucun des groupes de l'hôte ne fait partie |
|
355 |
# de cette liste, on affiche une erreur 403. |
|
356 |
h = Host.by_host_name(host) |
|
357 |
if len(set(h.groups).intersection(set(supitemgroups))) < 1: |
|
354 |
# Récupération des groupes dont l'hôte fait partie |
|
355 |
hostgroups = [g.idgroup for g in Host.by_host_name(host).groups] |
|
356 |
# Si aucun des groupes de l'hôte ne fait partie des groupes |
|
357 |
# auxquels l'utilisateur a accès, on affiche une erreur 403. |
|
358 |
if len(set(hostgroups).intersection(set(supitemgroups))) < 1: |
|
358 | 359 |
message = _('Access denied to host "%s"') % host |
359 | 360 |
LOGGER.warning(message) |
360 | 361 |
raise http_exc.HTTPForbidden(message) |
vigigraph/tests/functional/test_fullhostpage.py | ||
---|---|---|
40 | 40 |
|
41 | 41 |
def _check_results(self, user, hosts): |
42 | 42 |
for host in hosts: |
43 |
response = self.app.get( |
|
44 |
'/rpc/fullHostPage?host=%s' % host, |
|
45 |
extra_environ={"REMOTE_USER": user} |
|
46 |
) |
|
47 |
index = int(host[-1:]) |
|
48 | 43 |
if hosts[host]: |
44 |
response = self.app.get( |
|
45 |
'/rpc/fullHostPage?host=%s' % host, |
|
46 |
extra_environ={"REMOTE_USER": user} |
|
47 |
) |
|
48 |
index = int(host[-1:]) |
|
49 | 49 |
self.assertTrue( |
50 | 50 |
'/vigirrd/host%d/index?' |
51 | 51 |
'graphtemplate=graph%d' % (index, index) |
52 | 52 |
in response.body |
53 | 53 |
) |
54 | 54 |
else: |
55 |
self.assertTrue(
|
|
56 |
'/vigirrd/host%d/index?'
|
|
57 |
'graphtemplate=graph%d' % (index, index)
|
|
58 |
not in response.body
|
|
55 |
response = self.app.get(
|
|
56 |
'/rpc/fullHostPage?host=%s' % host,
|
|
57 |
extra_environ={"REMOTE_USER": user},
|
|
58 |
status = 403
|
|
59 | 59 |
) |
60 | 60 |
|
61 | 61 |
def test_direct_permission(self): |
Also available in: Unified diff