forked from DGNum/gestioCOF
b8110c11a4
kfet.open app - Base data (raw_open, last_update...) is stored and shared through cache system. - 2 websockets groups: one for team users, one for other users. - UI is initialized and kept up-to-date with WS. - raw_open and force_close can be updated with standard HTTP requests. At this time, there isn't any restriction on raw_open view. Common sense tell us to change this behavior. Misc - Clean channels routing. - 'PermConsumerMixin': user who sent the message is available as argument in connection_groups method, which returns groups to which the user should be appended on websocket connection (and discarded on disconnection). - New kfet.utils module: should be used for mixins, whatever is useful and not concerns the kfet app. - Clean JS dependencies.
19 lines
690 B
Python
19 lines
690 B
Python
# -*- coding: utf-8 -*-
|
|
|
|
from django.contrib import messages
|
|
from django.contrib.auth.signals import user_logged_in
|
|
from django.core.urlresolvers import reverse
|
|
from django.dispatch import receiver
|
|
|
|
|
|
@receiver(user_logged_in)
|
|
def messages_on_login(sender, request, user, **kwargs):
|
|
if (not user.username == 'kfet_genericteam' and
|
|
user.has_perm('kfet.is_team') and
|
|
hasattr(request, 'GET') and
|
|
'k-fet' in request.GET.get('next', '')):
|
|
messages.info(
|
|
request,
|
|
('<a href="{}" target="_blank">Connexion en utilisateur partagé ?</a>'
|
|
.format(reverse('kfet.login.genericteam'))),
|
|
extra_tags='safe')
|