Commit fa0855de authored by Rémi Duraffort's avatar Rémi Duraffort Committed by Neil Williams
Browse files

Remove v1 leftover

requested_device_type is always defined (except for dynamic connection).
Also fix a crash in the API with dynamic connections.

Change-Id: Id41d60b45a34a9c955deb622f5c450ce2056ac53
parent 717a3387
......@@ -926,10 +926,10 @@ class SchedulerAPI(ExposedAPI):
Q(id__in=job_id_list) | Q(sub_id__in=job_id_list)).select_related(
'actual_device', 'requested_device_type')
for job in jobs:
device_type = job.job_device_type()
device_type = job.requested_device_type
if not job.can_view(self.user) or not job.is_accessible_by(self.user) and not self.user.is_superuser:
if device_type.owners_only:
if device_type and device_type.owners_only:
# do the more expensive check second and only for a hidden device type
if not device_type.some_devices_visible_to(self.user):
......@@ -1806,7 +1806,7 @@ class TestJob(RestrictedResource):
if self._can_admin(user, resubmit=False):
return True
device_type = self.job_device_type()
device_type = self.requested_device_type
if device_type and device_type.owners_only:
if not device_type.some_devices_visible_to(user):
return False
......@@ -1873,14 +1873,6 @@ class TestJob(RestrictedResource):
(user.is_superuser or
def job_device_type(self):
device_type = None
if self.actual_device:
device_type = self.actual_device.device_type
elif self.requested_device_type:
device_type = self.requested_device_type
return device_type
def _generate_summary_mail(self):
domain = '???'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment