示例#1
0
 def deleteOneDevice(self,deviceId,userId):
     rows,isEof = database.db_select_sensor(deviceId=deviceId)
     for item in rows:
         self.deleteOneSensor(deviceId,item[0])
     authManager.deviceRemove(deviceId) #remove from accessKey
     database.db_delete_device(deviceId)
     database.db_delete_deviceauth(userId,deviceId)
     privilegeM.priv_del(masterId=userId,object='device',objectId=deviceId,master='user')
示例#2
0
 def delete(self):
     if self.userLoginCheck() != error.ERR_CODE_OK_:
         return
     requestApi = copy.deepcopy(restDef.RESTFUL_API[restDef.HTTP_RES['deviceAuth']]['@DELETE']['REQUEST'])
     responseApi = copy.deepcopy(restDef.RESTFUL_API[restDef.HTTP_RES['deviceAuth']]['@DELETE']['RESP'])
     self._getAllArguments(requestApi)
     if self.privilegeCheck(master='user',masterId=self.current_user,\
                           object='device',objectId=requestApi['deviceId'],\
                            operation='privilege_del') != error.ERR_CODE_OK_:
         return
     database.db_delete_deviceauth(requestApi['userId'], requestApi['deviceId'])
     privilegeM.priv_del(masterId=requestApi['userId'],object='device',objectId=requestApi['deviceId'])
     self.write(escape.json_encode(responseApi))