feat(cmedb): update get_admin_relations to use proper sqlalchemy syntax
parent
2f4b4c0a23
commit
7bfd048078
|
@ -606,18 +606,17 @@ class database:
|
||||||
|
|
||||||
def get_admin_relations(self, user_id=None, host_id=None):
|
def get_admin_relations(self, user_id=None, host_id=None):
|
||||||
if user_id:
|
if user_id:
|
||||||
results = self.conn.query(self.AdminRelationsTable).filter(
|
q = select(self.AdminRelationsTable).filter(
|
||||||
self.AdminRelationsTable.c.userid == user_id
|
self.AdminRelationsTable.c.userid == user_id
|
||||||
).all()
|
)
|
||||||
elif host_id:
|
elif host_id:
|
||||||
results = self.conn.query(self.AdminRelationsTable).filter(
|
q = select(self.AdminRelationsTable).filter(
|
||||||
self.AdminRelationsTable.c.computerid == host_id
|
self.AdminRelationsTable.c.computerid == host_id
|
||||||
).all()
|
)
|
||||||
else:
|
else:
|
||||||
results = self.conn.query(self.AdminRelationsTable).all()
|
q = select(self.AdminRelationsTable)
|
||||||
|
|
||||||
self.conn.commit()
|
results = asyncio.run(self.conn.execute(q)).all()
|
||||||
self.conn.close()
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def get_group_relations(self, user_id=None, group_id=None):
|
def get_group_relations(self, user_id=None, group_id=None):
|
||||||
|
|
Loading…
Reference in New Issue