本文整理汇总了Python中auth.Auth.delAuth方法的典型用法代码示例。如果您正苦于以下问题:Python Auth.delAuth方法的具体用法?Python Auth.delAuth怎么用?Python Auth.delAuth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth.Auth
的用法示例。
在下文中一共展示了Auth.delAuth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deleteUser
# 需要导入模块: from auth import Auth [as 别名]
# 或者: from auth.Auth import delAuth [as 别名]
def deleteUser(inData):
'''
:param inData:
:return: {1:'success', 2:'no user', 3:'permission denied', 4:'failed'}
'''
from auth import Auth
if(('updateId' in inData) and ('delId' in inData)):
updateUserLevel = session.query(User.level).filter(User.id == inData['updateId'], User.valid == 1).first()
if(updateUserLevel == None or int(updateUserLevel[0]) != 0):
return 3
else:
chgUser = session.query(User).filter(User.id == inData['delId'], User.valid == 1).first()
if(chgUser == None):
return 2
else:
session.query(User).filter(User.id == inData['delId']).update({'valid':0, 'time':datetime.now()})
session.commit()
Auth.delAuth({'UserId':inData['delId']})
return 1
else:
return 4
示例2: delSensor
# 需要导入模块: from auth import Auth [as 别名]
# 或者: from auth.Auth import delAuth [as 别名]
def delSensor(inData):
'''
:param: inData
:return: {1:'success', 2:'permission denied', 3:'no sensor', 4:'wrong param', 5:''}
'''
from auth import Auth
from eqp import Eqp
if(('UserId' in inData) and ('SensorId' in inData)):
updateUser = session.query(Auth).filter(Auth.userId == inData['UserId'], Auth.sensorId == inData['SensorId'], Auth.valid == 1).first()
if(updateUser == None):
updateUserLevel = session.query(User.level).filter(User.id == inData['UserId'], User.valid == 1).first()
if(updateUserLevel == None or int(updateUserLevel[0]) != 0):
return 2
tmpSensor = session.query(Sensor).filter(Sensor.id == inData['SensorId'], Sensor.valid == 1).first()
if(tmpSensor == None):
return 3
session.query(Sensor).filter(Sensor.id == inData['SensorId'], Sensor.valid == 1).update({'valid':0, 'time':datetime.now()})
Auth.delAuth({'SensorId':inData['SensorId']})
Eqp.delEqp({'SensorId':inData['SensorId']})
session.commit()
return 1
else:
return 4