def is_user_capable(user, api_name):
 user = urllib.unquote(user)
 sys.stderr.write((((('checking permissions for user ' + user) + ' on api ') + api_name) + '\n'))
 secret_file = open('/etc/appscale/secret.key', 'r')
 secret = secret_file.read()
 secret = secret[0:(-1)]
 secret_file.close()
 uaserver_file = open('/etc/appscale/hypersoap', 'r')
 uaserver = uaserver_file.read()
 uaserver_file.close()
 server = SOAPpy.SOAPProxy((('https://' + uaserver) + ':4343'))
 capabilities = server.get_capabilities(user, secret)
 if (not isinstance(capabilities, str)):
  return False
 capabilities = capabilities.split(':')
 sys.stderr.write((((('user ' + user) + ' has the following capabilities: ') + str(capabilities)) + '\n'))
 if (api_name in capabilities):
  return True
 else:
  return False

def is_user_capable ( user , api_name ) : user = urllib . unquote ( user ) sys . stderr . write ( ( ( ( ( 'checking permissions for user ' + user ) + ' on api ' ) + api_name ) + '\n' ) ) secret_file = open ( '/etc/appscale/secret.key' , 'r' ) secret = secret_file . read ( ) secret = secret [ 0 : ( - 1 ) ] secret_file . close ( ) uaserver_file = open ( '/etc/appscale/hypersoap' , 'r' ) uaserver = uaserver_file . read ( ) uaserver_file . close ( ) server = SOAPpy . SOAPProxy ( ( ( 'https://' + uaserver ) + ':4343' ) ) capabilities = server . get_capabilities ( user , secret ) if ( not isinstance ( capabilities , str ) ) : return False capabilities = capabilities . split ( ':' ) sys . stderr . write ( ( ( ( ( 'user ' + user ) + ' has the following capabilities: ' ) + str ( capabilities ) ) + '\n' ) ) if ( api_name in capabilities ) : return True else : return False
checks to see if the given user has access to user a particular api .