Projet

Général

Profil

0002-urls_utils-automatically-request-missing-role.patch

Valentin Deniaud, 05 juin 2019 15:08

Télécharger (1,08 ko)

Voir les différences:

Subject: [PATCH 2/4] urls_utils: automatically request missing role

 chrono/urls_utils.py | 7 +++++++
 1 file changed, 7 insertions(+)
chrono/urls_utils.py
23 23

  
24 24
from .agendas.models import Agenda
25 25

  
26
try:
27
    from mellon.utils import check_session_roles
28
except ImportError:
29
    check_session_roles = None
30

  
26 31

  
27 32
class DecoratedURLPattern(RegexURLPattern):
28 33
    def resolve(self, *args, **kwargs):
......
66 71
        return False
67 72
    actual_decorator = user_passes_test(check_manager, login_url=login_url)
68 73
    if function:
74
        if check_session_roles:
75
            return check_session_roles(actual_decorator(function))
69 76
        return actual_decorator(function)
70 77
    return actual_decorator
71
-