1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-12 19:38:57 +00:00

Force refresh of updated_at value for RBAC db models.

This commit is contained in:
grossmj 2021-06-01 16:12:06 +09:30
parent a6d2f48df1
commit 36a27c0c19

View File

@ -96,12 +96,14 @@ class RbacRepository(BaseRepository):
update_values = role_update.dict(exclude_unset=True)
query = update(models.Role).\
where(models.Role.role_id == role_id).\
values(update_values).\
execution_options(synchronize_session="fetch")
values(update_values)
await self._db_session.execute(query)
await self._db_session.commit()
return await self.get_role(role_id)
role_db = await self.get_role(role_id)
if role_db:
await self._db_session.refresh(role_db) # force refresh of updated_at value
return role_db
async def delete_role(self, role_id: UUID) -> bool:
"""
@ -235,12 +237,14 @@ class RbacRepository(BaseRepository):
update_values = permission_update.dict(exclude_unset=True)
query = update(models.Permission).\
where(models.Permission.permission_id == permission_id).\
values(update_values).\
execution_options(synchronize_session="fetch")
values(update_values)
await self._db_session.execute(query)
await self._db_session.commit()
return await self.get_permission(permission_id)
permission_db = await self.get_permission(permission_id)
if permission_db:
await self._db_session.refresh(permission_db) # force refresh of updated_at value
return permission_db
async def delete_permission(self, permission_id: UUID) -> bool:
"""