|
@@ -42,7 +42,8 @@ from hadoop.yarn.clients import get_log_client
|
|
|
|
|
|
|
|
from jobbrowser import conf
|
|
from jobbrowser import conf
|
|
|
from jobbrowser.api import get_api, ApplicationNotRunning
|
|
from jobbrowser.api import get_api, ApplicationNotRunning
|
|
|
-from jobbrowser.models import Job, JobLinkage, Tracker, Cluster
|
|
|
|
|
|
|
+from jobbrowser.models import Job, JobLinkage, Tracker, Cluster, can_view_job,\
|
|
|
|
|
+ can_modify_job
|
|
|
|
|
|
|
|
import urllib2
|
|
import urllib2
|
|
|
|
|
|
|
@@ -139,7 +140,7 @@ def massage_job_for_json(job, request):
|
|
|
'finishTimeFormatted': hasattr(job, 'finishTimeFormatted') and job.finishTimeFormatted or '',
|
|
'finishTimeFormatted': hasattr(job, 'finishTimeFormatted') and job.finishTimeFormatted or '',
|
|
|
'durationFormatted': hasattr(job, 'durationFormatted') and job.durationFormatted or '',
|
|
'durationFormatted': hasattr(job, 'durationFormatted') and job.durationFormatted or '',
|
|
|
'durationMs': hasattr(job, 'durationInMillis') and job.durationInMillis or '',
|
|
'durationMs': hasattr(job, 'durationInMillis') and job.durationInMillis or '',
|
|
|
- 'canKill': (job.status.lower() == 'running' or job.status.lower() == 'pending') and not job.is_mr2 and (request.user.is_superuser or request.user.username == job.user),
|
|
|
|
|
|
|
+ 'canKill': (job.status.lower() == 'running' or job.status.lower() == 'pending') and not job.is_mr2 and (request.user.is_superuser or request.user.username == job.user or can_modify_job(request.user.username, job.full_job_conf)),
|
|
|
'killUrl': job.jobId and reverse('jobbrowser.views.kill_job', kwargs={'job': job.jobId}) or ''
|
|
'killUrl': job.jobId and reverse('jobbrowser.views.kill_job', kwargs={'job': job.jobId}) or ''
|
|
|
}
|
|
}
|
|
|
return job
|
|
return job
|