Exemplo n.º 1
0
 def accessKeyCheck(self, deviceId):
     key = self.request.headers.get('accessKey')
     if (key is None) or (key is ''):
         self.send_error_msg(self.__ERRCODE__['keyinvalid'])
         return error.ERR_CODE_ERR_
     if not authManager.deviceIsAccessed(deviceId,key):
         self.send_error_msg(self.__ERRCODE__['notaccess'])
         return error.ERR_CODE_ERR_
     return error.ERR_CODE_OK_
Exemplo n.º 2
0
 def userOrAccessKeyCheck(self,deviceId):
     accessKey = self.request.headers.get('accessKey')
     if (accessKey is not None) or (accessKey is not ''): #accessKey
         if authManager.deviceIsAccessed(deviceId,accessKey):
             return error.ERR_CODE_ACCESSKEY_CHECK_OK
     #user
     if self.current_user != 0:
         return error.ERR_CODE_USER_CHECK_OK
     self.send_error_msg(self.__ERRCODE__['bothauth'])
     return error.ERR_CODE_ERR_