Subversion Repositories SmartDukaan

Rev

Rev 494 | Rev 765 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 494 Rev 759
Line 76... Line 76...
76
    """
76
    """
77
    pass
77
    pass
78
 
78
 
79
  def authenticateUser(self, username, password):
79
  def authenticateUser(self, username, password):
80
    """
80
    """
-
 
81
    Returns the warehouseId for the given user if the password matches. Returns -1 otherwise.
-
 
82
    The loggedOn timestamp for the dashboard user is updated as a timestamp.
-
 
83
    It's unclear to me when an exception is thrown : Chandranshu
-
 
84
    
81
    Parameters:
85
    Parameters:
82
     - username
86
     - username
83
     - password
87
     - password
84
    """
88
    """
85
    pass
89
    pass
Line 91... Line 95...
91
     - oldPassword
95
     - oldPassword
92
     - newPassword
96
     - newPassword
93
    """
97
    """
94
    pass
98
    pass
95
 
99
 
-
 
100
  def authenticateLogisticsUser(self, username, password):
-
 
101
    """
-
 
102
    Returns the LogisticsUser struct associated with the given username and password if they match.
-
 
103
    Throws an exception otherwise.
-
 
104
    
-
 
105
    Parameters:
-
 
106
     - username
-
 
107
     - password
-
 
108
    """
-
 
109
    pass
-
 
110
 
96
 
111
 
97
class Client(Iface):
112
class Client(Iface):
98
  def __init__(self, iprot, oprot=None):
113
  def __init__(self, iprot, oprot=None):
99
    self._iprot = self._oprot = iprot
114
    self._iprot = self._oprot = iprot
100
    if oprot != None:
115
    if oprot != None:
Line 357... Line 372...
357
      raise result.se
372
      raise result.se
358
    raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteUser failed: unknown result");
373
    raise TApplicationException(TApplicationException.MISSING_RESULT, "deleteUser failed: unknown result");
359
 
374
 
360
  def authenticateUser(self, username, password):
375
  def authenticateUser(self, username, password):
361
    """
376
    """
-
 
377
    Returns the warehouseId for the given user if the password matches. Returns -1 otherwise.
-
 
378
    The loggedOn timestamp for the dashboard user is updated as a timestamp.
-
 
379
    It's unclear to me when an exception is thrown : Chandranshu
-
 
380
    
362
    Parameters:
381
    Parameters:
363
     - username
382
     - username
364
     - password
383
     - password
365
    """
384
    """
366
    self.send_authenticateUser(username, password)
385
    self.send_authenticateUser(username, password)
Line 425... Line 444...
425
      return result.success
444
      return result.success
426
    if result.se != None:
445
    if result.se != None:
427
      raise result.se
446
      raise result.se
428
    raise TApplicationException(TApplicationException.MISSING_RESULT, "updatePassword failed: unknown result");
447
    raise TApplicationException(TApplicationException.MISSING_RESULT, "updatePassword failed: unknown result");
429
 
448
 
-
 
449
  def authenticateLogisticsUser(self, username, password):
-
 
450
    """
-
 
451
    Returns the LogisticsUser struct associated with the given username and password if they match.
-
 
452
    Throws an exception otherwise.
-
 
453
    
-
 
454
    Parameters:
-
 
455
     - username
-
 
456
     - password
-
 
457
    """
-
 
458
    self.send_authenticateLogisticsUser(username, password)
-
 
459
    return self.recv_authenticateLogisticsUser()
-
 
460
 
-
 
461
  def send_authenticateLogisticsUser(self, username, password):
-
 
462
    self._oprot.writeMessageBegin('authenticateLogisticsUser', TMessageType.CALL, self._seqid)
-
 
463
    args = authenticateLogisticsUser_args()
-
 
464
    args.username = username
-
 
465
    args.password = password
-
 
466
    args.write(self._oprot)
-
 
467
    self._oprot.writeMessageEnd()
-
 
468
    self._oprot.trans.flush()
-
 
469
 
-
 
470
  def recv_authenticateLogisticsUser(self, ):
-
 
471
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
472
    if mtype == TMessageType.EXCEPTION:
-
 
473
      x = TApplicationException()
-
 
474
      x.read(self._iprot)
-
 
475
      self._iprot.readMessageEnd()
-
 
476
      raise x
-
 
477
    result = authenticateLogisticsUser_result()
-
 
478
    result.read(self._iprot)
-
 
479
    self._iprot.readMessageEnd()
-
 
480
    if result.success != None:
-
 
481
      return result.success
-
 
482
    if result.hse != None:
-
 
483
      raise result.hse
-
 
484
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateLogisticsUser failed: unknown result");
-
 
485
 
430
 
486
 
431
class Processor(Iface, TProcessor):
487
class Processor(Iface, TProcessor):
432
  def __init__(self, handler):
488
  def __init__(self, handler):
433
    self._handler = handler
489
    self._handler = handler
434
    self._processMap = {}
490
    self._processMap = {}
Line 440... Line 496...
440
    self._processMap["getSubstitutedMessage"] = Processor.process_getSubstitutedMessage
496
    self._processMap["getSubstitutedMessage"] = Processor.process_getSubstitutedMessage
441
    self._processMap["addUser"] = Processor.process_addUser
497
    self._processMap["addUser"] = Processor.process_addUser
442
    self._processMap["deleteUser"] = Processor.process_deleteUser
498
    self._processMap["deleteUser"] = Processor.process_deleteUser
443
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
499
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
444
    self._processMap["updatePassword"] = Processor.process_updatePassword
500
    self._processMap["updatePassword"] = Processor.process_updatePassword
-
 
501
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
445
 
502
 
446
  def process(self, iprot, oprot):
503
  def process(self, iprot, oprot):
447
    (name, type, seqid) = iprot.readMessageBegin()
504
    (name, type, seqid) = iprot.readMessageBegin()
448
    if name not in self._processMap:
505
    if name not in self._processMap:
449
      iprot.skip(TType.STRUCT)
506
      iprot.skip(TType.STRUCT)
Line 596... Line 653...
596
    oprot.writeMessageBegin("updatePassword", TMessageType.REPLY, seqid)
653
    oprot.writeMessageBegin("updatePassword", TMessageType.REPLY, seqid)
597
    result.write(oprot)
654
    result.write(oprot)
598
    oprot.writeMessageEnd()
655
    oprot.writeMessageEnd()
599
    oprot.trans.flush()
656
    oprot.trans.flush()
600
 
657
 
-
 
658
  def process_authenticateLogisticsUser(self, seqid, iprot, oprot):
-
 
659
    args = authenticateLogisticsUser_args()
-
 
660
    args.read(iprot)
-
 
661
    iprot.readMessageEnd()
-
 
662
    result = authenticateLogisticsUser_result()
-
 
663
    try:
-
 
664
      result.success = self._handler.authenticateLogisticsUser(args.username, args.password)
-
 
665
    except HelperServiceException, hse:
-
 
666
      result.hse = hse
-
 
667
    oprot.writeMessageBegin("authenticateLogisticsUser", TMessageType.REPLY, seqid)
-
 
668
    result.write(oprot)
-
 
669
    oprot.writeMessageEnd()
-
 
670
    oprot.trans.flush()
-
 
671
 
601
 
672
 
602
# HELPER FUNCTIONS AND STRUCTURES
673
# HELPER FUNCTIONS AND STRUCTURES
603
 
674
 
604
class sendMail_args:
675
class sendMail_args:
605
  """
676
  """
Line 1884... Line 1955...
1884
      oprot.writeFieldEnd()
1955
      oprot.writeFieldEnd()
1885
    oprot.writeFieldStop()
1956
    oprot.writeFieldStop()
1886
    oprot.writeStructEnd()
1957
    oprot.writeStructEnd()
1887
 
1958
 
1888
  def __repr__(self):
1959
  def __repr__(self):
-
 
1960
    L = ['%s=%r' % (key, value)
-
 
1961
      for key, value in self.__dict__.iteritems()]
-
 
1962
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
1963
 
-
 
1964
  def __eq__(self, other):
-
 
1965
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
1966
 
-
 
1967
  def __ne__(self, other):
-
 
1968
    return not (self == other)
-
 
1969
 
-
 
1970
class authenticateLogisticsUser_args:
-
 
1971
  """
-
 
1972
  Attributes:
-
 
1973
   - username
-
 
1974
   - password
-
 
1975
  """
-
 
1976
 
-
 
1977
  thrift_spec = (
-
 
1978
    None, # 0
-
 
1979
    (1, TType.STRING, 'username', None, None, ), # 1
-
 
1980
    (2, TType.STRING, 'password', None, None, ), # 2
-
 
1981
  )
-
 
1982
 
-
 
1983
  def __init__(self, username=None, password=None,):
-
 
1984
    self.username = username
-
 
1985
    self.password = password
-
 
1986
 
-
 
1987
  def read(self, iprot):
-
 
1988
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
1989
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
1990
      return
-
 
1991
    iprot.readStructBegin()
-
 
1992
    while True:
-
 
1993
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
1994
      if ftype == TType.STOP:
-
 
1995
        break
-
 
1996
      if fid == 1:
-
 
1997
        if ftype == TType.STRING:
-
 
1998
          self.username = iprot.readString();
-
 
1999
        else:
-
 
2000
          iprot.skip(ftype)
-
 
2001
      elif fid == 2:
-
 
2002
        if ftype == TType.STRING:
-
 
2003
          self.password = iprot.readString();
-
 
2004
        else:
-
 
2005
          iprot.skip(ftype)
-
 
2006
      else:
-
 
2007
        iprot.skip(ftype)
-
 
2008
      iprot.readFieldEnd()
-
 
2009
    iprot.readStructEnd()
-
 
2010
 
-
 
2011
  def write(self, oprot):
-
 
2012
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2013
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2014
      return
-
 
2015
    oprot.writeStructBegin('authenticateLogisticsUser_args')
-
 
2016
    if self.username != None:
-
 
2017
      oprot.writeFieldBegin('username', TType.STRING, 1)
-
 
2018
      oprot.writeString(self.username)
-
 
2019
      oprot.writeFieldEnd()
-
 
2020
    if self.password != None:
-
 
2021
      oprot.writeFieldBegin('password', TType.STRING, 2)
-
 
2022
      oprot.writeString(self.password)
-
 
2023
      oprot.writeFieldEnd()
-
 
2024
    oprot.writeFieldStop()
-
 
2025
    oprot.writeStructEnd()
-
 
2026
 
-
 
2027
  def __repr__(self):
-
 
2028
    L = ['%s=%r' % (key, value)
-
 
2029
      for key, value in self.__dict__.iteritems()]
-
 
2030
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2031
 
-
 
2032
  def __eq__(self, other):
-
 
2033
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2034
 
-
 
2035
  def __ne__(self, other):
-
 
2036
    return not (self == other)
-
 
2037
 
-
 
2038
class authenticateLogisticsUser_result:
-
 
2039
  """
-
 
2040
  Attributes:
-
 
2041
   - success
-
 
2042
   - hse
-
 
2043
  """
-
 
2044
 
-
 
2045
  thrift_spec = (
-
 
2046
    (0, TType.STRUCT, 'success', (LogisticsUser, LogisticsUser.thrift_spec), None, ), # 0
-
 
2047
    (1, TType.STRUCT, 'hse', (HelperServiceException, HelperServiceException.thrift_spec), None, ), # 1
-
 
2048
  )
-
 
2049
 
-
 
2050
  def __init__(self, success=None, hse=None,):
-
 
2051
    self.success = success
-
 
2052
    self.hse = hse
-
 
2053
 
-
 
2054
  def read(self, iprot):
-
 
2055
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2056
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2057
      return
-
 
2058
    iprot.readStructBegin()
-
 
2059
    while True:
-
 
2060
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2061
      if ftype == TType.STOP:
-
 
2062
        break
-
 
2063
      if fid == 0:
-
 
2064
        if ftype == TType.STRUCT:
-
 
2065
          self.success = LogisticsUser()
-
 
2066
          self.success.read(iprot)
-
 
2067
        else:
-
 
2068
          iprot.skip(ftype)
-
 
2069
      elif fid == 1:
-
 
2070
        if ftype == TType.STRUCT:
-
 
2071
          self.hse = HelperServiceException()
-
 
2072
          self.hse.read(iprot)
-
 
2073
        else:
-
 
2074
          iprot.skip(ftype)
-
 
2075
      else:
-
 
2076
        iprot.skip(ftype)
-
 
2077
      iprot.readFieldEnd()
-
 
2078
    iprot.readStructEnd()
-
 
2079
 
-
 
2080
  def write(self, oprot):
-
 
2081
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2082
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2083
      return
-
 
2084
    oprot.writeStructBegin('authenticateLogisticsUser_result')
-
 
2085
    if self.success != None:
-
 
2086
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
2087
      self.success.write(oprot)
-
 
2088
      oprot.writeFieldEnd()
-
 
2089
    if self.hse != None:
-
 
2090
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
-
 
2091
      self.hse.write(oprot)
-
 
2092
      oprot.writeFieldEnd()
-
 
2093
    oprot.writeFieldStop()
-
 
2094
    oprot.writeStructEnd()
-
 
2095
 
-
 
2096
  def __repr__(self):
1889
    L = ['%s=%r' % (key, value)
2097
    L = ['%s=%r' % (key, value)
1890
      for key, value in self.__dict__.iteritems()]
2098
      for key, value in self.__dict__.iteritems()]
1891
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
2099
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1892
 
2100
 
1893
  def __eq__(self, other):
2101
  def __eq__(self, other):