diff options
Diffstat (limited to 'module/remote/thriftbackend')
5 files changed, 70 insertions, 15 deletions
| diff --git a/module/remote/thriftbackend/Handler.py b/module/remote/thriftbackend/Handler.py index 9a7c1489e..e45cdfcaa 100644 --- a/module/remote/thriftbackend/Handler.py +++ b/module/remote/thriftbackend/Handler.py @@ -445,8 +445,8 @@ class Handler(Iface):          Parameters:           - exclusive          """ -        tid, data, type = self.serverMethods.get_captcha_task(exclusive) -        t = CaptchaTask(int(tid), standard_b64encode(data), type) +        tid, data, type, result = self.serverMethods.get_captcha_task(exclusive) +        t = CaptchaTask(int(tid), standard_b64encode(data), type, result)          return t      def getCaptchaTaskStatus(self, tid): @@ -536,7 +536,7 @@ class Handler(Iface):          """          return self.backend.checkAuth(username, password, remoteip) -    def getUserData(self): +    def getUserData(self, username, password):          return self.serverMethods.checkAuth(username, password) diff --git a/module/remote/thriftbackend/pyload.thrift b/module/remote/thriftbackend/pyload.thrift index c26334051..52fa1f08d 100644 --- a/module/remote/thriftbackend/pyload.thrift +++ b/module/remote/thriftbackend/pyload.thrift @@ -118,7 +118,8 @@ struct PackageInfo {  struct CaptchaTask {    1: i16 tid,    2: binary data, -  3: string type +  3: string type, +  4: string resultType  }  struct Event { @@ -250,7 +251,7 @@ service Pyload {    //auth    bool login(1: string username, 2: string password), -  UserData getUserData(), +  UserData getUserData(1: string username, 2:string password),    //services    map<string, ServiceInfo> getServices(), diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote index a9311d32b..d87ef6e28 100755 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload-remote @@ -77,7 +77,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':    print '  void updateAccounts(AccountData data)'    print '  void removeAccount(string plugin, string account)'    print '  bool login(string username, string password)' -  print '  UserData getUserData()' +  print '  UserData getUserData(string username, string password)'    print '   getServices()'    print '  bool hasService(string plugin, string func)'    print '  string call(ServiceCall info)' @@ -468,10 +468,10 @@ elif cmd == 'login':    pp.pprint(client.login(args[0],args[1],))  elif cmd == 'getUserData': -  if len(args) != 0: -    print 'getUserData requires 0 args' +  if len(args) != 2: +    print 'getUserData requires 2 args'      sys.exit(1) -  pp.pprint(client.getUserData()) +  pp.pprint(client.getUserData(args[0],args[1],))  elif cmd == 'getServices':    if len(args) != 0: diff --git a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py index ba9d6a7a2..e4cfba605 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/Pyload.py +++ b/module/remote/thriftbackend/thriftgen/pyload/Pyload.py @@ -334,7 +334,12 @@ class Iface:      """      pass -  def getUserData(self, ): +  def getUserData(self, username, password): +    """ +    Parameters: +     - username +     - password +    """      pass    def getServices(self, ): @@ -1914,13 +1919,20 @@ class Client(Iface):        return result.success      raise TApplicationException(TApplicationException.MISSING_RESULT, "login failed: unknown result"); -  def getUserData(self, ): -    self.send_getUserData() +  def getUserData(self, username, password): +    """ +    Parameters: +     - username +     - password +    """ +    self.send_getUserData(username, password)      return self.recv_getUserData() -  def send_getUserData(self, ): +  def send_getUserData(self, username, password):      self._oprot.writeMessageBegin('getUserData', TMessageType.CALL, self._seqid)      args = getUserData_args() +    args.username = username +    args.password = password      args.write(self._oprot)      self._oprot.writeMessageEnd()      self._oprot.trans.flush() @@ -2738,7 +2750,7 @@ class Processor(Iface, TProcessor):      args.read(iprot)      iprot.readMessageEnd()      result = getUserData_result() -    result.success = self._handler.getUserData() +    result.success = self._handler.getUserData(args.username, args.password)      oprot.writeMessageBegin("getUserData", TMessageType.REPLY, seqid)      result.write(oprot)      oprot.writeMessageEnd() @@ -8897,10 +8909,22 @@ class login_result:      return not (self == other)  class getUserData_args: +  """ +  Attributes: +   - username +   - password +  """    thrift_spec = ( +    None, # 0 +    (1, TType.STRING, 'username', None, None, ), # 1 +    (2, TType.STRING, 'password', None, None, ), # 2    ) +  def __init__(self, username=None, password=None,): +    self.username = username +    self.password = password +    def read(self, iprot):      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:        fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec)) @@ -8910,6 +8934,16 @@ class getUserData_args:        (fname, ftype, fid) = iprot.readFieldBegin()        if ftype == TType.STOP:          break +      if fid == 1: +        if ftype == TType.STRING: +          self.username = iprot.readString(); +        else: +          iprot.skip(ftype) +      elif fid == 2: +        if ftype == TType.STRING: +          self.password = iprot.readString(); +        else: +          iprot.skip(ftype)        else:          iprot.skip(ftype)        iprot.readFieldEnd() @@ -8920,6 +8954,14 @@ class getUserData_args:        oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))        return      oprot.writeStructBegin('getUserData_args') +    if self.username != None: +      oprot.writeFieldBegin('username', TType.STRING, 1) +      oprot.writeString(self.username) +      oprot.writeFieldEnd() +    if self.password != None: +      oprot.writeFieldBegin('password', TType.STRING, 2) +      oprot.writeString(self.password) +      oprot.writeFieldEnd()      oprot.writeFieldStop()      oprot.writeStructEnd()      def validate(self): diff --git a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py index b3ef98de3..6fec5a405 100644 --- a/module/remote/thriftbackend/thriftgen/pyload/ttypes.py +++ b/module/remote/thriftbackend/thriftgen/pyload/ttypes.py @@ -1153,6 +1153,7 @@ class CaptchaTask:     - tid     - data     - type +   - resultType    """    thrift_spec = ( @@ -1160,12 +1161,14 @@ class CaptchaTask:      (1, TType.I16, 'tid', None, None, ), # 1      (2, TType.STRING, 'data', None, None, ), # 2      (3, TType.STRING, 'type', None, None, ), # 3 +    (4, TType.STRING, 'resultType', None, None, ), # 4    ) -  def __init__(self, tid=None, data=None, type=None,): +  def __init__(self, tid=None, data=None, type=None, resultType=None,):      self.tid = tid      self.data = data      self.type = type +    self.resultType = resultType    def read(self, iprot):      if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -1191,6 +1194,11 @@ class CaptchaTask:            self.type = iprot.readString();          else:            iprot.skip(ftype) +      elif fid == 4: +        if ftype == TType.STRING: +          self.resultType = iprot.readString(); +        else: +          iprot.skip(ftype)        else:          iprot.skip(ftype)        iprot.readFieldEnd() @@ -1213,6 +1221,10 @@ class CaptchaTask:        oprot.writeFieldBegin('type', TType.STRING, 3)        oprot.writeString(self.type)        oprot.writeFieldEnd() +    if self.resultType != None: +      oprot.writeFieldBegin('resultType', TType.STRING, 4) +      oprot.writeString(self.resultType) +      oprot.writeFieldEnd()      oprot.writeFieldStop()      oprot.writeStructEnd()      def validate(self): | 
