def check_access(action, context, data_dict=None):
 try:
  audit = context.get('__auth_audit', [])[(-1)]
 except IndexError:
  audit = ''
 if (audit and (audit[0] == action)):
  context['__auth_audit'].pop()
 user = context.get('user')
 try:
  if ('auth_user_obj' not in context):
   context['auth_user_obj'] = None
  if (not context.get('ignore_auth')):
   if (not context.get('__auth_user_obj_checked')):
    if (context.get('user') and (not context.get('auth_user_obj'))):
     context['auth_user_obj'] = model.User.by_name(context['user'])
    context['__auth_user_obj_checked'] = True
  context = _prepopulate_context(context)
  logic_authorization = authz.is_authorized(action, context, data_dict)
  if (not logic_authorization['success']):
   msg = logic_authorization.get('msg', '')
   raise NotAuthorized(msg)
 except NotAuthorized as e:
  log.debug(u'check access NotAuthorized - %s user=%s "%s"', action, user, unicode(e))
  raise
 log.debug('check access OK - %s user=%s', action, user)
 return True

def check_access ( action , context , data_dict = None ) : try : audit = context . get ( '__auth_audit' , [ ] ) [ ( - 1 ) ] except IndexError : audit = '' if ( audit and ( audit [ 0 ] == action ) ) : context [ '__auth_audit' ] . pop ( ) user = context . get ( 'user' ) try : if ( 'auth_user_obj' not in context ) : context [ 'auth_user_obj' ] = None if ( not context . get ( 'ignore_auth' ) ) : if ( not context . get ( '__auth_user_obj_checked' ) ) : if ( context . get ( 'user' ) and ( not context . get ( 'auth_user_obj' ) ) ) : context [ 'auth_user_obj' ] = model . User . by_name ( context [ 'user' ] ) context [ '__auth_user_obj_checked' ] = True context = _prepopulate_context ( context ) logic_authorization = authz . is_authorized ( action , context , data_dict ) if ( not logic_authorization [ 'success' ] ) : msg = logic_authorization . get ( 'msg' , '' ) raise NotAuthorized ( msg ) except NotAuthorized as e : log . debug ( u'check access NotAuthorized - %s user=%s "%s"' , action , user , unicode ( e ) ) raise log . debug ( 'check access OK - %s user=%s' , action , user ) return True
check if external address is allowed given access_type access_type: 1=nzb .