Subversion Repositories SmartDukaan

Rev

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

Rev 1610 Rev 1891
Line 149... Line 149...
149
     - username
149
     - username
150
     - password
150
     - password
151
    """
151
    """
152
    pass
152
    pass
153
 
153
 
-
 
154
  def authenticateReportUser(self, username, password):
-
 
155
    """
-
 
156
    Returns the ReportUser struct associated with the given username and password if they match.
-
 
157
    Throws an exception otherwise.
-
 
158
    
-
 
159
    Parameters:
-
 
160
     - username
-
 
161
     - password
-
 
162
    """
-
 
163
    pass
-
 
164
 
-
 
165
  def getReports(self, role):
-
 
166
    """
-
 
167
    Returns list of reports which are configured for the given role.
-
 
168
    
-
 
169
    Parameters:
-
 
170
     - role
-
 
171
    """
-
 
172
    pass
-
 
173
 
154
 
174
 
155
class Client(Iface):
175
class Client(Iface):
156
  def __init__(self, iprot, oprot=None):
176
  def __init__(self, iprot, oprot=None):
157
    self._iprot = self._oprot = iprot
177
    self._iprot = self._oprot = iprot
158
    if oprot != None:
178
    if oprot != None:
Line 689... Line 709...
689
      return result.success
709
      return result.success
690
    if result.hse != None:
710
    if result.hse != None:
691
      raise result.hse
711
      raise result.hse
692
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateStatisticsUser failed: unknown result");
712
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateStatisticsUser failed: unknown result");
693
 
713
 
-
 
714
  def authenticateReportUser(self, username, password):
-
 
715
    """
-
 
716
    Returns the ReportUser struct associated with the given username and password if they match.
-
 
717
    Throws an exception otherwise.
-
 
718
    
-
 
719
    Parameters:
-
 
720
     - username
-
 
721
     - password
-
 
722
    """
-
 
723
    self.send_authenticateReportUser(username, password)
-
 
724
    return self.recv_authenticateReportUser()
-
 
725
 
-
 
726
  def send_authenticateReportUser(self, username, password):
-
 
727
    self._oprot.writeMessageBegin('authenticateReportUser', TMessageType.CALL, self._seqid)
-
 
728
    args = authenticateReportUser_args()
-
 
729
    args.username = username
-
 
730
    args.password = password
-
 
731
    args.write(self._oprot)
-
 
732
    self._oprot.writeMessageEnd()
-
 
733
    self._oprot.trans.flush()
-
 
734
 
-
 
735
  def recv_authenticateReportUser(self, ):
-
 
736
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
737
    if mtype == TMessageType.EXCEPTION:
-
 
738
      x = TApplicationException()
-
 
739
      x.read(self._iprot)
-
 
740
      self._iprot.readMessageEnd()
-
 
741
      raise x
-
 
742
    result = authenticateReportUser_result()
-
 
743
    result.read(self._iprot)
-
 
744
    self._iprot.readMessageEnd()
-
 
745
    if result.success != None:
-
 
746
      return result.success
-
 
747
    if result.hse != None:
-
 
748
      raise result.hse
-
 
749
    raise TApplicationException(TApplicationException.MISSING_RESULT, "authenticateReportUser failed: unknown result");
-
 
750
 
-
 
751
  def getReports(self, role):
-
 
752
    """
-
 
753
    Returns list of reports which are configured for the given role.
-
 
754
    
-
 
755
    Parameters:
-
 
756
     - role
-
 
757
    """
-
 
758
    self.send_getReports(role)
-
 
759
    return self.recv_getReports()
-
 
760
 
-
 
761
  def send_getReports(self, role):
-
 
762
    self._oprot.writeMessageBegin('getReports', TMessageType.CALL, self._seqid)
-
 
763
    args = getReports_args()
-
 
764
    args.role = role
-
 
765
    args.write(self._oprot)
-
 
766
    self._oprot.writeMessageEnd()
-
 
767
    self._oprot.trans.flush()
-
 
768
 
-
 
769
  def recv_getReports(self, ):
-
 
770
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
771
    if mtype == TMessageType.EXCEPTION:
-
 
772
      x = TApplicationException()
-
 
773
      x.read(self._iprot)
-
 
774
      self._iprot.readMessageEnd()
-
 
775
      raise x
-
 
776
    result = getReports_result()
-
 
777
    result.read(self._iprot)
-
 
778
    self._iprot.readMessageEnd()
-
 
779
    if result.success != None:
-
 
780
      return result.success
-
 
781
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getReports failed: unknown result");
-
 
782
 
694
 
783
 
695
class Processor(Iface, TProcessor):
784
class Processor(Iface, TProcessor):
696
  def __init__(self, handler):
785
  def __init__(self, handler):
697
    self._handler = handler
786
    self._handler = handler
698
    self._processMap = {}
787
    self._processMap = {}
Line 710... Line 799...
710
    self._processMap["deleteUser"] = Processor.process_deleteUser
799
    self._processMap["deleteUser"] = Processor.process_deleteUser
711
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
800
    self._processMap["authenticateUser"] = Processor.process_authenticateUser
712
    self._processMap["updatePassword"] = Processor.process_updatePassword
801
    self._processMap["updatePassword"] = Processor.process_updatePassword
713
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
802
    self._processMap["authenticateLogisticsUser"] = Processor.process_authenticateLogisticsUser
714
    self._processMap["authenticateStatisticsUser"] = Processor.process_authenticateStatisticsUser
803
    self._processMap["authenticateStatisticsUser"] = Processor.process_authenticateStatisticsUser
-
 
804
    self._processMap["authenticateReportUser"] = Processor.process_authenticateReportUser
-
 
805
    self._processMap["getReports"] = Processor.process_getReports
715
 
806
 
716
  def process(self, iprot, oprot):
807
  def process(self, iprot, oprot):
717
    (name, type, seqid) = iprot.readMessageBegin()
808
    (name, type, seqid) = iprot.readMessageBegin()
718
    if name not in self._processMap:
809
    if name not in self._processMap:
719
      iprot.skip(TType.STRUCT)
810
      iprot.skip(TType.STRUCT)
Line 947... Line 1038...
947
    oprot.writeMessageBegin("authenticateStatisticsUser", TMessageType.REPLY, seqid)
1038
    oprot.writeMessageBegin("authenticateStatisticsUser", TMessageType.REPLY, seqid)
948
    result.write(oprot)
1039
    result.write(oprot)
949
    oprot.writeMessageEnd()
1040
    oprot.writeMessageEnd()
950
    oprot.trans.flush()
1041
    oprot.trans.flush()
951
 
1042
 
-
 
1043
  def process_authenticateReportUser(self, seqid, iprot, oprot):
-
 
1044
    args = authenticateReportUser_args()
-
 
1045
    args.read(iprot)
-
 
1046
    iprot.readMessageEnd()
-
 
1047
    result = authenticateReportUser_result()
-
 
1048
    try:
-
 
1049
      result.success = self._handler.authenticateReportUser(args.username, args.password)
-
 
1050
    except HelperServiceException, hse:
-
 
1051
      result.hse = hse
-
 
1052
    oprot.writeMessageBegin("authenticateReportUser", TMessageType.REPLY, seqid)
-
 
1053
    result.write(oprot)
-
 
1054
    oprot.writeMessageEnd()
-
 
1055
    oprot.trans.flush()
-
 
1056
 
-
 
1057
  def process_getReports(self, seqid, iprot, oprot):
-
 
1058
    args = getReports_args()
-
 
1059
    args.read(iprot)
-
 
1060
    iprot.readMessageEnd()
-
 
1061
    result = getReports_result()
-
 
1062
    result.success = self._handler.getReports(args.role)
-
 
1063
    oprot.writeMessageBegin("getReports", TMessageType.REPLY, seqid)
-
 
1064
    result.write(oprot)
-
 
1065
    oprot.writeMessageEnd()
-
 
1066
    oprot.trans.flush()
-
 
1067
 
952
 
1068
 
953
# HELPER FUNCTIONS AND STRUCTURES
1069
# HELPER FUNCTIONS AND STRUCTURES
954
 
1070
 
955
class closeSession_args:
1071
class closeSession_args:
956
 
1072
 
Line 3004... Line 3120...
3004
      oprot.writeFieldEnd()
3120
      oprot.writeFieldEnd()
3005
    oprot.writeFieldStop()
3121
    oprot.writeFieldStop()
3006
    oprot.writeStructEnd()
3122
    oprot.writeStructEnd()
3007
 
3123
 
3008
  def __repr__(self):
3124
  def __repr__(self):
-
 
3125
    L = ['%s=%r' % (key, value)
-
 
3126
      for key, value in self.__dict__.iteritems()]
-
 
3127
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3128
 
-
 
3129
  def __eq__(self, other):
-
 
3130
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3131
 
-
 
3132
  def __ne__(self, other):
-
 
3133
    return not (self == other)
-
 
3134
 
-
 
3135
class authenticateReportUser_args:
-
 
3136
  """
-
 
3137
  Attributes:
-
 
3138
   - username
-
 
3139
   - password
-
 
3140
  """
-
 
3141
 
-
 
3142
  thrift_spec = (
-
 
3143
    None, # 0
-
 
3144
    (1, TType.STRING, 'username', None, None, ), # 1
-
 
3145
    (2, TType.STRING, 'password', None, None, ), # 2
-
 
3146
  )
-
 
3147
 
-
 
3148
  def __init__(self, username=None, password=None,):
-
 
3149
    self.username = username
-
 
3150
    self.password = password
-
 
3151
 
-
 
3152
  def read(self, iprot):
-
 
3153
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3154
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3155
      return
-
 
3156
    iprot.readStructBegin()
-
 
3157
    while True:
-
 
3158
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3159
      if ftype == TType.STOP:
-
 
3160
        break
-
 
3161
      if fid == 1:
-
 
3162
        if ftype == TType.STRING:
-
 
3163
          self.username = iprot.readString();
-
 
3164
        else:
-
 
3165
          iprot.skip(ftype)
-
 
3166
      elif fid == 2:
-
 
3167
        if ftype == TType.STRING:
-
 
3168
          self.password = iprot.readString();
-
 
3169
        else:
-
 
3170
          iprot.skip(ftype)
-
 
3171
      else:
-
 
3172
        iprot.skip(ftype)
-
 
3173
      iprot.readFieldEnd()
-
 
3174
    iprot.readStructEnd()
-
 
3175
 
-
 
3176
  def write(self, oprot):
-
 
3177
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3178
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3179
      return
-
 
3180
    oprot.writeStructBegin('authenticateReportUser_args')
-
 
3181
    if self.username != None:
-
 
3182
      oprot.writeFieldBegin('username', TType.STRING, 1)
-
 
3183
      oprot.writeString(self.username)
-
 
3184
      oprot.writeFieldEnd()
-
 
3185
    if self.password != None:
-
 
3186
      oprot.writeFieldBegin('password', TType.STRING, 2)
-
 
3187
      oprot.writeString(self.password)
-
 
3188
      oprot.writeFieldEnd()
-
 
3189
    oprot.writeFieldStop()
-
 
3190
    oprot.writeStructEnd()
-
 
3191
 
-
 
3192
  def __repr__(self):
-
 
3193
    L = ['%s=%r' % (key, value)
-
 
3194
      for key, value in self.__dict__.iteritems()]
-
 
3195
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3196
 
-
 
3197
  def __eq__(self, other):
-
 
3198
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3199
 
-
 
3200
  def __ne__(self, other):
-
 
3201
    return not (self == other)
-
 
3202
 
-
 
3203
class authenticateReportUser_result:
-
 
3204
  """
-
 
3205
  Attributes:
-
 
3206
   - success
-
 
3207
   - hse
-
 
3208
  """
-
 
3209
 
-
 
3210
  thrift_spec = (
-
 
3211
    (0, TType.STRUCT, 'success', (ReportUser, ReportUser.thrift_spec), None, ), # 0
-
 
3212
    (1, TType.STRUCT, 'hse', (HelperServiceException, HelperServiceException.thrift_spec), None, ), # 1
-
 
3213
  )
-
 
3214
 
-
 
3215
  def __init__(self, success=None, hse=None,):
-
 
3216
    self.success = success
-
 
3217
    self.hse = hse
-
 
3218
 
-
 
3219
  def read(self, iprot):
-
 
3220
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3221
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3222
      return
-
 
3223
    iprot.readStructBegin()
-
 
3224
    while True:
-
 
3225
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3226
      if ftype == TType.STOP:
-
 
3227
        break
-
 
3228
      if fid == 0:
-
 
3229
        if ftype == TType.STRUCT:
-
 
3230
          self.success = ReportUser()
-
 
3231
          self.success.read(iprot)
-
 
3232
        else:
-
 
3233
          iprot.skip(ftype)
-
 
3234
      elif fid == 1:
-
 
3235
        if ftype == TType.STRUCT:
-
 
3236
          self.hse = HelperServiceException()
-
 
3237
          self.hse.read(iprot)
-
 
3238
        else:
-
 
3239
          iprot.skip(ftype)
-
 
3240
      else:
-
 
3241
        iprot.skip(ftype)
-
 
3242
      iprot.readFieldEnd()
-
 
3243
    iprot.readStructEnd()
-
 
3244
 
-
 
3245
  def write(self, oprot):
-
 
3246
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3247
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3248
      return
-
 
3249
    oprot.writeStructBegin('authenticateReportUser_result')
-
 
3250
    if self.success != None:
-
 
3251
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
-
 
3252
      self.success.write(oprot)
-
 
3253
      oprot.writeFieldEnd()
-
 
3254
    if self.hse != None:
-
 
3255
      oprot.writeFieldBegin('hse', TType.STRUCT, 1)
-
 
3256
      self.hse.write(oprot)
-
 
3257
      oprot.writeFieldEnd()
-
 
3258
    oprot.writeFieldStop()
-
 
3259
    oprot.writeStructEnd()
-
 
3260
 
-
 
3261
  def __repr__(self):
-
 
3262
    L = ['%s=%r' % (key, value)
-
 
3263
      for key, value in self.__dict__.iteritems()]
-
 
3264
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3265
 
-
 
3266
  def __eq__(self, other):
-
 
3267
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3268
 
-
 
3269
  def __ne__(self, other):
-
 
3270
    return not (self == other)
-
 
3271
 
-
 
3272
class getReports_args:
-
 
3273
  """
-
 
3274
  Attributes:
-
 
3275
   - role
-
 
3276
  """
-
 
3277
 
-
 
3278
  thrift_spec = (
-
 
3279
    None, # 0
-
 
3280
    (1, TType.I64, 'role', None, None, ), # 1
-
 
3281
  )
-
 
3282
 
-
 
3283
  def __init__(self, role=None,):
-
 
3284
    self.role = role
-
 
3285
 
-
 
3286
  def read(self, iprot):
-
 
3287
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3288
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3289
      return
-
 
3290
    iprot.readStructBegin()
-
 
3291
    while True:
-
 
3292
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3293
      if ftype == TType.STOP:
-
 
3294
        break
-
 
3295
      if fid == 1:
-
 
3296
        if ftype == TType.I64:
-
 
3297
          self.role = iprot.readI64();
-
 
3298
        else:
-
 
3299
          iprot.skip(ftype)
-
 
3300
      else:
-
 
3301
        iprot.skip(ftype)
-
 
3302
      iprot.readFieldEnd()
-
 
3303
    iprot.readStructEnd()
-
 
3304
 
-
 
3305
  def write(self, oprot):
-
 
3306
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3307
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3308
      return
-
 
3309
    oprot.writeStructBegin('getReports_args')
-
 
3310
    if self.role != None:
-
 
3311
      oprot.writeFieldBegin('role', TType.I64, 1)
-
 
3312
      oprot.writeI64(self.role)
-
 
3313
      oprot.writeFieldEnd()
-
 
3314
    oprot.writeFieldStop()
-
 
3315
    oprot.writeStructEnd()
-
 
3316
 
-
 
3317
  def __repr__(self):
-
 
3318
    L = ['%s=%r' % (key, value)
-
 
3319
      for key, value in self.__dict__.iteritems()]
-
 
3320
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
3321
 
-
 
3322
  def __eq__(self, other):
-
 
3323
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
3324
 
-
 
3325
  def __ne__(self, other):
-
 
3326
    return not (self == other)
-
 
3327
 
-
 
3328
class getReports_result:
-
 
3329
  """
-
 
3330
  Attributes:
-
 
3331
   - success
-
 
3332
  """
-
 
3333
 
-
 
3334
  thrift_spec = (
-
 
3335
    (0, TType.LIST, 'success', (TType.STRUCT,(Report, Report.thrift_spec)), None, ), # 0
-
 
3336
  )
-
 
3337
 
-
 
3338
  def __init__(self, success=None,):
-
 
3339
    self.success = success
-
 
3340
 
-
 
3341
  def read(self, iprot):
-
 
3342
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
3343
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
3344
      return
-
 
3345
    iprot.readStructBegin()
-
 
3346
    while True:
-
 
3347
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
3348
      if ftype == TType.STOP:
-
 
3349
        break
-
 
3350
      if fid == 0:
-
 
3351
        if ftype == TType.LIST:
-
 
3352
          self.success = []
-
 
3353
          (_etype33, _size30) = iprot.readListBegin()
-
 
3354
          for _i34 in xrange(_size30):
-
 
3355
            _elem35 = Report()
-
 
3356
            _elem35.read(iprot)
-
 
3357
            self.success.append(_elem35)
-
 
3358
          iprot.readListEnd()
-
 
3359
        else:
-
 
3360
          iprot.skip(ftype)
-
 
3361
      else:
-
 
3362
        iprot.skip(ftype)
-
 
3363
      iprot.readFieldEnd()
-
 
3364
    iprot.readStructEnd()
-
 
3365
 
-
 
3366
  def write(self, oprot):
-
 
3367
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
3368
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
3369
      return
-
 
3370
    oprot.writeStructBegin('getReports_result')
-
 
3371
    if self.success != None:
-
 
3372
      oprot.writeFieldBegin('success', TType.LIST, 0)
-
 
3373
      oprot.writeListBegin(TType.STRUCT, len(self.success))
-
 
3374
      for iter36 in self.success:
-
 
3375
        iter36.write(oprot)
-
 
3376
      oprot.writeListEnd()
-
 
3377
      oprot.writeFieldEnd()
-
 
3378
    oprot.writeFieldStop()
-
 
3379
    oprot.writeStructEnd()
-
 
3380
 
-
 
3381
  def __repr__(self):
3009
    L = ['%s=%r' % (key, value)
3382
    L = ['%s=%r' % (key, value)
3010
      for key, value in self.__dict__.iteritems()]
3383
      for key, value in self.__dict__.iteritems()]
3011
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
3384
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
3012
 
3385
 
3013
  def __eq__(self, other):
3386
  def __eq__(self, other):