def ignore_not_package_admin(key, data, errors, context):
 model = context['model']
 user = context.get('user')
 if ('ignore_auth' in context):
  return
 if (user and authz.is_sysadmin(user)):
  return
 authorized = False
 pkg = context.get('package')
 if pkg:
  try:
   logic.check_access('package_change_state', context)
   authorized = True
  except logic.NotAuthorized:
   authorized = False
 if (user and pkg and authorized):
  return
 if ((key == ('state',)) and context.get('allow_state_change')):
  return
 data.pop(key)

def ignore_not_package_admin ( key , data , errors , context ) : model = context [ 'model' ] user = context . get ( 'user' ) if ( 'ignore_auth' in context ) : return if ( user and authz . is_sysadmin ( user ) ) : return authorized = False pkg = context . get ( 'package' ) if pkg : try : logic . check_access ( 'package_change_state' , context ) authorized = True except logic . NotAuthorized : authorized = False if ( user and pkg and authorized ) : return if ( ( key == ( 'state' , ) ) and context . get ( 'allow_state_change' ) ) : return data . pop ( key )
ignore if the user is not allowed to administer the package specified .