def check_query_table(self,dbtag,username):
list = Tb_blacklist.objects.filter(dbtag=dbtag)
if list :
#user in white list
if User.objects.get(username=username) in list[0].user_permit.all():
existTb=[]
else :
#if table in black list
blackTblist = list[0].tbname.split(',')
parser = Sqlparse(self.sql)
tblist = parser.extract_tables()
existTb = [val for val in blackTblist if val in tblist]
if existTb:
return True,existTb
return False,[]
评论列表
文章目录