mirror of
				https://gitlab.com/animath/si/plateforme.git
				synced 2025-11-04 09:02:11 +01:00 
			
		
		
		
	Allow to impersonate user on draw interface
Signed-off-by: Emmy D'Anello <emmy.danello@animath.fr>
This commit is contained in:
		@@ -9,6 +9,7 @@ from random import randint, shuffle
 | 
				
			|||||||
from asgiref.sync import sync_to_async
 | 
					from asgiref.sync import sync_to_async
 | 
				
			||||||
from channels.generic.websocket import AsyncJsonWebsocketConsumer
 | 
					from channels.generic.websocket import AsyncJsonWebsocketConsumer
 | 
				
			||||||
from django.conf import settings
 | 
					from django.conf import settings
 | 
				
			||||||
 | 
					from django.contrib.auth.models import User
 | 
				
			||||||
from django.contrib.contenttypes.models import ContentType
 | 
					from django.contrib.contenttypes.models import ContentType
 | 
				
			||||||
from django.utils import translation
 | 
					from django.utils import translation
 | 
				
			||||||
from django.utils.translation import gettext_lazy as _
 | 
					from django.utils.translation import gettext_lazy as _
 | 
				
			||||||
@@ -44,6 +45,8 @@ class DrawConsumer(AsyncJsonWebsocketConsumer):
 | 
				
			|||||||
        We accept only if this is a user of a team of the associated tournament, or a volunteer
 | 
					        We accept only if this is a user of a team of the associated tournament, or a volunteer
 | 
				
			||||||
        of the tournament.
 | 
					        of the tournament.
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
 | 
					        if '_fake_user_id' in self.scope['session']:
 | 
				
			||||||
 | 
					            self.scope['user'] = await User.objects.aget(pk=self.scope['session']['_fake_user_id'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Fetch the registration of the current user
 | 
					        # Fetch the registration of the current user
 | 
				
			||||||
        user = self.scope['user']
 | 
					        user = self.scope['user']
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user