Revision 9f441867
Prise en compte de l'utilisation du compte manager dans la méthode du contrôleur faisant appel aux plugins.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@6434 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/controllers/root.py | ||
---|---|---|
701 | 701 |
if plugin_name not in plugins: |
702 | 702 |
raise HTTPNotFound(_("No such plugin '%s'") % plugin_name) |
703 | 703 |
|
704 |
# Récupération du nom de l'utilisateur
|
|
705 |
user = get_current_user()
|
|
704 |
is_manager = in_group('managers').is_met(request.environ)
|
|
705 |
if not is_manager:
|
|
706 | 706 |
|
707 |
# Vérification des permissions de l'utilisateur |
|
708 |
events = DBSession.query( |
|
709 |
CorrEvent.idcorrevent |
|
710 |
).join( |
|
711 |
(Event, Event.idevent == CorrEvent.idcause), |
|
712 |
).outerjoin( |
|
713 |
(LowLevelService, LowLevelService.idservice == Event.idsupitem), |
|
714 |
).join( |
|
715 |
(SUPITEM_GROUP_TABLE, |
|
716 |
or_( |
|
717 |
SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
718 |
LowLevelService.idhost, |
|
719 |
SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
720 |
Event.idsupitem, |
|
721 |
) |
|
722 |
), |
|
723 |
).join( |
|
724 |
(GroupHierarchy, GroupHierarchy.idchild == SUPITEM_GROUP_TABLE.c.idgroup), |
|
725 |
).join( |
|
726 |
(DataPermission, DataPermission.idgroup == GroupHierarchy.idparent), |
|
727 |
).join( |
|
728 |
(USER_GROUP_TABLE, USER_GROUP_TABLE.c.idgroup == DataPermission.idusergroup), |
|
729 |
).filter(USER_GROUP_TABLE.c.username == user.user_name |
|
730 |
).filter(CorrEvent.idcorrevent == idcorrevent |
|
731 |
).count() |
|
732 |
|
|
733 |
# Pas d'événement ou permission refusée. On ne distingue pas |
|
734 |
# les 2 cas afin d'éviter la divulgation d'informations. |
|
735 |
if events == 0: |
|
736 |
raise HTTPNotFound(_('No such incident or insufficient ' |
|
737 |
'permissions')) |
|
707 |
# Récupération du nom de l'utilisateur |
|
708 |
user = get_current_user() |
|
709 |
|
|
710 |
# Vérification des permissions de l'utilisateur |
|
711 |
events = DBSession.query( |
|
712 |
CorrEvent.idcorrevent |
|
713 |
).join( |
|
714 |
(Event, Event.idevent == CorrEvent.idcause), |
|
715 |
).outerjoin( |
|
716 |
(LowLevelService, LowLevelService.idservice == Event.idsupitem), |
|
717 |
).join( |
|
718 |
(SUPITEM_GROUP_TABLE, |
|
719 |
or_( |
|
720 |
SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
721 |
LowLevelService.idhost, |
|
722 |
SUPITEM_GROUP_TABLE.c.idsupitem == \ |
|
723 |
Event.idsupitem, |
|
724 |
) |
|
725 |
), |
|
726 |
).join( |
|
727 |
(GroupHierarchy, GroupHierarchy.idchild == SUPITEM_GROUP_TABLE.c.idgroup), |
|
728 |
).join( |
|
729 |
(DataPermission, DataPermission.idgroup == GroupHierarchy.idparent), |
|
730 |
).join( |
|
731 |
(USER_GROUP_TABLE, USER_GROUP_TABLE.c.idgroup == DataPermission.idusergroup), |
|
732 |
).filter(USER_GROUP_TABLE.c.username == user.user_name |
|
733 |
).filter(CorrEvent.idcorrevent == idcorrevent |
|
734 |
).count() |
|
735 |
|
|
736 |
# Pas d'événement ou permission refusée. On ne distingue pas |
|
737 |
# les 2 cas afin d'éviter la divulgation d'informations. |
|
738 |
if events == 0: |
|
739 |
raise HTTPNotFound(_('No such incident or insufficient ' |
|
740 |
'permissions')) |
|
738 | 741 |
|
739 | 742 |
return plugins[plugin_name].get_json_data(idcorrevent, *arg, **krgv) |
740 | 743 |
|
Also available in: Unified diff