def check_job_permission(view_func):
 def decorate(request, *args, **kwargs):
  jobid = kwargs['job']
  try:
   job = get_job(request, job_id=jobid)
  except ApplicationNotRunning as e:
   LOG.warn(('Job %s has not yet been accepted by the RM, will poll for status.' % jobid))
   return job_not_assigned(request, jobid, request.path)
  if ((not SHARE_JOBS.get()) and (not request.user.is_superuser) and (job.user != request.user.username) and (not can_view_job(request.user.username, job))):
   raise PopupException((_("You don't have permission to access job %(id)s.") % {'id': jobid}))
  kwargs['job'] = job
  return view_func(request, *args, **kwargs)
 return wraps(view_func)(decorate)

def check_job_permission ( view_func ) : def decorate ( request , * args , ** kwargs ) : jobid = kwargs [ 'job' ] try : job = get_job ( request , job_id = jobid ) except ApplicationNotRunning as e : LOG . warn ( ( 'Job %s has not yet been accepted by the RM, will poll for status.' % jobid ) ) return job_not_assigned ( request , jobid , request . path ) if ( ( not SHARE_JOBS . get ( ) ) and ( not request . user . is_superuser ) and ( job . user != request . user . username ) and ( not can_view_job ( request . user . username , job ) ) ) : raise PopupException ( ( _ ( "You don't have permission to access job %(id)s." ) % { 'id' : jobid } ) ) kwargs [ 'job' ] = job return view_func ( request , * args , ** kwargs ) return wraps ( view_func ) ( decorate )
ensure that the user has access to the job .