Subversion Repositories SmartDukaan

Rev

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

Rev 1891 Rev 2025
Line 169... Line 169...
169
    Parameters:
169
    Parameters:
170
     - role
170
     - role
171
    """
171
    """
172
    pass
172
    pass
173
 
173
 
-
 
174
  def authenticateCatalogUser(self, username, password):
-
 
175
    """
-
 
176
    Returns the CatalogDashboardUser struct associated with the given username and password if they match.
-
 
177
    Throws an exception otherwise.
-
 
178
    
-
 
179
    Parameters:
-
 
180
     - username
-
 
181
     - password
-
 
182
    """
-
 
183
    pass
-
 
184
 
174
 
185
 
175
class Client(Iface):
186
class Client(Iface):
176
  def __init__(self, iprot, oprot=None):
187
  def __init__(self, iprot, oprot=None):
177
    self._iprot = self._oprot = iprot
188
    self._iprot = self._oprot = iprot
178
    if oprot != None:
189
    if oprot != None:
Line 778... Line 789...
778
    self._iprot.readMessageEnd()
789
    self._iprot.readMessageEnd()
779
    if result.success != None:
790
    if result.success != None:
780
      return result.success
791
      return result.success
781
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getReports failed: unknown result");
792
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getReports failed: unknown result");
782
 
793
 
-
 
794
  def authenticateCatalogUser(self, username, password):
-
 
795
    """
-
 
796
    Returns the CatalogDashboardUser struct associated with the given username and password if they match.
-
 
797
    Throws an exception otherwise.
-
 
798
    
-
 
799
    Parameters:
-
 
800
     - username
-
 
801
     - password
-
 
802
    """
-
 
803
    self.send_authenticateCatalogUser(username, password)
-
 
804
    return self.recv_authenticateCatalogUser()
-
 
805
 
-
 
806
  def send_authenticateCatalogUser(self, username, password):
-
 
807
    self._oprot.writeMessageBegin('authenticateCatalogUser', TMessageType.CALL, self._seqid)
-
 
808
    args = authenticateCatalogUser_args()
-
 
809
    args.username = username
-
 
810
    args.password = password
-
 
811
    args.write(self._oprot)
-
 
812
    self._oprot.writeMessageEnd()
-
 
813
    self._oprot.trans.flush()
-
 
814
 
-
 
815
  def recv_authenticateCatalogUser(self, ):
-
 
816
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
817
    if mtype == TMessageType.EXCEPTION:
-
 
818
      x = TApplicationException()
-
 
819
      x.read(self._iprot)
-
 
820
      self._iprot.readMessageEnd()
-
 
821
      raise x
-
 
822
    result = authenticateCatalogUser_result()
-
 
823
    result.read(self._iprot)
-
 
824
    self._iprot.readMessageEnd()
-
 
825
    if result.success != None:
-
 
826
      return result.success
-
 
827
    if result.hse != None:
-
 
828
      raise result.hse
-
 
829
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateCatalogUser failed: unknown result");
-
 
830
 
783
 
831
 
784
class Processor(Iface, TProcessor):
832
class Processor(Iface, TProcessor):
785
  def __init__(self, handler):
833
  def __init__(self, handler):
786
    self._handler = handler
834
    self._handler = handler
787
    self._processMap = {}
835
    self._processMap = {}
Line 801... Line 849...
801
    self._processMap["updatePassword"] = Processor.process_updatePassword
849
    self._processMap["updatePassword"] = Processor.process_updatePassword
802
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
850
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
803
    self._processMap["authenticateStatisticsUser"] = Processor.process_authenticateStatisticsUser
851
    self._processMap["authenticateStatisticsUser"] = Processor.process_authenticateStatisticsUser
804
    self._processMap["authenticateReportUser"] = Processor.process_authenticateReportUser
852
    self._processMap["authenticateReportUser"] = Processor.process_authenticateReportUser
805
    self._processMap["getReports"] = Processor.process_getReports
853
    self._processMap["getReports"] = Processor.process_getReports
-
 
854
    self._processMap["authenticateCatalogUser"] = Processor.process_authenticateCatalogUser
806
 
855
 
807
  def process(self, iprot, oprot):
856
  def process(self, iprot, oprot):
808
    (name, type, seqid) = iprot.readMessageBegin()
857
    (name, type, seqid) = iprot.readMessageBegin()
809
    if name not in self._processMap:
858
    if name not in self._processMap:
810
      iprot.skip(TType.STRUCT)
859
      iprot.skip(TType.STRUCT)
Line 1063... Line 1112...
1063
    oprot.writeMessageBegin("getReports", TMessageType.REPLY, seqid)
1112
    oprot.writeMessageBegin("getReports", TMessageType.REPLY, seqid)
1064
    result.write(oprot)
1113
    result.write(oprot)
1065
    oprot.writeMessageEnd()
1114
    oprot.writeMessageEnd()
1066
    oprot.trans.flush()
1115
    oprot.trans.flush()
1067
 
1116
 
-
 
1117
  def process_authenticateCatalogUser(self, seqid, iprot, oprot):
-
 
1118
    args = authenticateCatalogUser_args()
-
 
1119
    args.read(iprot)
-
 
1120
    iprot.readMessageEnd()
-
 
1121
    result = authenticateCatalogUser_result()
-
 
1122
    try:
-
 
1123
      result.success = self._handler.authenticateCatalogUser(args.username, args.password)
-
 
1124
    except HelperServiceException, hse:
-
 
1125
      result.hse = hse
-
 
1126
    oprot.writeMessageBegin("authenticateCatalogUser", TMessageType.REPLY, seqid)
-
 
1127
    result.write(oprot)
-
 
1128
    oprot.writeMessageEnd()
-
 
1129
    oprot.trans.flush()
-
 
1130
 
1068
 
1131
 
1069
# HELPER FUNCTIONS AND STRUCTURES
1132
# HELPER FUNCTIONS AND STRUCTURES
1070
 
1133
 
1071
class closeSession_args:
1134
class closeSession_args:
1072
 
1135
 
Line 3377... Line 3440...
3377
      oprot.writeFieldEnd()
3440
      oprot.writeFieldEnd()
3378
    oprot.writeFieldStop()
3441
    oprot.writeFieldStop()
3379
    oprot.writeStructEnd()
3442
    oprot.writeStructEnd()
3380
 
3443
 
3381
  def __repr__(self):
3444
  def __repr__(self):
-
 
3445
    L = ['%s=%r' % (key, value)
-
 
3446
      for key, value in self.__dict__.iteritems()]
-
 
3447
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3448
 
-
 
3449
  def __eq__(self, other):
-
 
3450
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3451
 
-
 
3452
  def __ne__(self, other):
-
 
3453
    return not (self == other)
-
 
3454
 
-
 
3455
class authenticateCatalogUser_args:
-
 
3456
  """
-
 
3457
  Attributes:
-
 
3458
   - username
-
 
3459
   - password
-
 
3460
  """
-
 
3461
 
-
 
3462
  thrift_spec = (
-
 
3463
    None, # 0
-
 
3464
    (1, TType.STRING, 'username', None, None, ), # 1
-
 
3465
    (2, TType.STRING, 'password', None, None, ), # 2
-
 
3466
  )
-
 
3467
 
-
 
3468
  def __init__(self, username=None, password=None,):
-
 
3469
    self.username = username
-
 
3470
    self.password = password
-
 
3471
 
-
 
3472
  def read(self, iprot):
-
 
3473
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3474
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3475
      return
-
 
3476
    iprot.readStructBegin()
-
 
3477
    while True:
-
 
3478
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3479
      if ftype == TType.STOP:
-
 
3480
        break
-
 
3481
      if fid == 1:
-
 
3482
        if ftype == TType.STRING:
-
 
3483
          self.username = iprot.readString();
-
 
3484
        else:
-
 
3485
          iprot.skip(ftype)
-
 
3486
      elif fid == 2:
-
 
3487
        if ftype == TType.STRING:
-
 
3488
          self.password = iprot.readString();
-
 
3489
        else:
-
 
3490
          iprot.skip(ftype)
-
 
3491
      else:
-
 
3492
        iprot.skip(ftype)
-
 
3493
      iprot.readFieldEnd()
-
 
3494
    iprot.readStructEnd()
-
 
3495
 
-
 
3496
  def write(self, oprot):
-
 
3497
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3498
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3499
      return
-
 
3500
    oprot.writeStructBegin('authenticateCatalogUser_args')
-
 
3501
    if self.username != None:
-
 
3502
      oprot.writeFieldBegin('username', TType.STRING, 1)
-
 
3503
      oprot.writeString(self.username)
-
 
3504
      oprot.writeFieldEnd()
-
 
3505
    if self.password != None:
-
 
3506
      oprot.writeFieldBegin('password', TType.STRING, 2)
-
 
3507
      oprot.writeString(self.password)
-
 
3508
      oprot.writeFieldEnd()
-
 
3509
    oprot.writeFieldStop()
-
 
3510
    oprot.writeStructEnd()
-
 
3511
 
-
 
3512
  def __repr__(self):
-
 
3513
    L = ['%s=%r' % (key, value)
-
 
3514
      for key, value in self.__dict__.iteritems()]
-
 
3515
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3516
 
-
 
3517
  def __eq__(self, other):
-
 
3518
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3519
 
-
 
3520
  def __ne__(self, other):
-
 
3521
    return not (self == other)
-
 
3522
 
-
 
3523
class authenticateCatalogUser_result:
-
 
3524
  """
-
 
3525
  Attributes:
-
 
3526
   - success
-
 
3527
   - hse
-
 
3528
  """
-
 
3529
 
-
 
3530
  thrift_spec = (
-
 
3531
    (0, TType.STRUCT, 'success', (CatalogDashboardUser, CatalogDashboardUser.thrift_spec), None, ), # 0
-
 
3532
    (1, TType.STRUCT, 'hse', (HelperServiceException, HelperServiceException.thrift_spec), None, ), # 1
-
 
3533
  )
-
 
3534
 
-
 
3535
  def __init__(self, success=None, hse=None,):
-
 
3536
    self.success = success
-
 
3537
    self.hse = hse
-
 
3538
 
-
 
3539
  def read(self, iprot):
-
 
3540
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3541
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3542
      return
-
 
3543
    iprot.readStructBegin()
-
 
3544
    while True:
-
 
3545
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3546
      if ftype == TType.STOP:
-
 
3547
        break
-
 
3548
      if fid == 0:
-
 
3549
        if ftype == TType.STRUCT:
-
 
3550
          self.success = CatalogDashboardUser()
-
 
3551
          self.success.read(iprot)
-
 
3552
        else:
-
 
3553
          iprot.skip(ftype)
-
 
3554
      elif fid == 1:
-
 
3555
        if ftype == TType.STRUCT:
-
 
3556
          self.hse = HelperServiceException()
-
 
3557
          self.hse.read(iprot)
-
 
3558
        else:
-
 
3559
          iprot.skip(ftype)
-
 
3560
      else:
-
 
3561
        iprot.skip(ftype)
-
 
3562
      iprot.readFieldEnd()
-
 
3563
    iprot.readStructEnd()
-
 
3564
 
-
 
3565
  def write(self, oprot):
-
 
3566
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3567
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3568
      return
-
 
3569
    oprot.writeStructBegin('authenticateCatalogUser_result')
-
 
3570
    if self.success != None:
-
 
3571
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
3572
      self.success.write(oprot)
-
 
3573
      oprot.writeFieldEnd()
-
 
3574
    if self.hse != None:
-
 
3575
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
-
 
3576
      self.hse.write(oprot)
-
 
3577
      oprot.writeFieldEnd()
-
 
3578
    oprot.writeFieldStop()
-
 
3579
    oprot.writeStructEnd()
-
 
3580
 
-
 
3581
  def __repr__(self):
3382
    L = ['%s=%r' % (key, value)
3582
    L = ['%s=%r' % (key, value)
3383
      for key, value in self.__dict__.iteritems()]
3583
      for key, value in self.__dict__.iteritems()]
3384
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
3584
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
3385
 
3585
 
3386
  def __eq__(self, other):
3586
  def __eq__(self, other):