Beispiel #1
0
 def process_request(self, request):
     super(ApacheAuthMiddleware, self).process_request(request)
     username = thread_local.get_user()
     thread_local.set_user(None)
     user_object = auth.authenticate(username=username, password='')
     auth.login(request, user_object)
     thread_local.set_user(models.User.objects.get(login=username))
Beispiel #2
0
 def current_user(cls):
     user = thread_local.get_user()
     if user is None:
         user, _ = cls.objects.get_or_create(login=cls.AUTOTEST_SYSTEM)
         user.access_level = cls.ACCESS_ROOT
         user.save()
     return user
Beispiel #3
0
 def current_user(cls):
     user = thread_local.get_user()
     if user is None:
         user, _ = cls.objects.get_or_create(login=cls.AUTOTEST_SYSTEM)
         user.access_level = cls.ACCESS_ROOT
         user.save()
     return user
Beispiel #4
0
 def process_request(self, request):
     super(ApacheAuthMiddleware, self).process_request(request)
     username = thread_local.get_user()
     thread_local.set_user(None)
     user_object = auth.authenticate(username=username,
                                     password='')
     auth.login(request, user_object)
     thread_local.set_user(models.User.objects.get(login=username))
Beispiel #5
0
 def update(self, input_dict):
     if 'aborted' in input_dict:
         if input_dict['aborted'] != True:
             raise exceptions.BadRequest('"aborted" can only be set to true')
         query = models.HostQueueEntry.objects.filter(pk=self.instance.pk)
         models.AclGroup.check_abort_permissions(query)
         rpc_utils.check_abort_synchronous_jobs(query)
         self.instance.abort(thread_local.get_user())
Beispiel #6
0
 def update(self, input_dict):
     if 'aborted' in input_dict:
         if input_dict['aborted'] != True:
             raise exceptions.BadRequest('"aborted" can only be set to true')
         query = models.HostQueueEntry.objects.filter(pk=self.instance.pk)
         models.AclGroup.check_abort_permissions(query)
         rpc_utils.check_abort_synchronous_jobs(query)
         self.instance.abort(thread_local.get_user())
Beispiel #7
0
 def save(self, *args, **kwargs):
     # is this a new object being saved for the first time?
     first_time = (self.id is None)
     user = thread_local.get_user()
     if user and not user.is_superuser() and user.login != self.login:
         raise AclAccessViolation("You cannot modify user " + self.login)
     super(User, self).save(*args, **kwargs)
     if first_time:
         everyone = AclGroup.objects.get(name='Everyone')
         everyone.users.add(self)
Beispiel #8
0
 def save(self, *args, **kwargs):
     # is this a new object being saved for the first time?
     first_time = (self.id is None)
     user = thread_local.get_user()
     if user and not user.is_superuser() and user.login != self.login:
         raise AclAccessViolation("You cannot modify user " + self.login)
     super(User, self).save(*args, **kwargs)
     if first_time:
         everyone = AclGroup.objects.get(name='Everyone')
         everyone.users.add(self)