mirror of
https://github.com/GNS3/gns3-server.git
synced 2026-11-03 05:51:15 +02:00
refactor: add efficient get_aces_for_path method for resource pool checks
Add a new repository method get_aces_for_path() that: - Queries ACEs for a specific path at database level (more efficient) - Preloads related user, group, and role objects to prevent 500 errors - Keeps original get_aces() method unchanged to avoid performance impact This improves both performance and code clarity for resource pool deletion safety checks.
This commit is contained in:
2 files changed
+20
-2
No files matched your search
@@ -149,8 +149,7 @@ async def delete_resource_pool(
|
||||
|
||||
# Check if there are any ACE configurations using this resource pool path
|
||||
pool_path = f"/pools/{resource_pool_id}"
|
||||
aces = await rbac_repo.get_aces()
|
||||
using_aces = [ace for ace in aces if ace.path == pool_path or ace.path.startswith(pool_path + "/")]
|
||||
using_aces = await rbac_repo.get_aces_for_path(pool_path)
|
||||
|
||||
if using_aces:
|
||||
# Build detailed error message with ACE information
|
||||
|
||||
Reference in new issue
Block a user