From 6ec97a704f249e7f1479c146dfa8e1b7435948ca Mon Sep 17 00:00:00 2001
From: grossmj <grossmj@gns3.net>
Date: Sat, 2 Sep 2023 19:10:02 +0700
Subject: [PATCH] Put user, groups, roles and ACL under /access

---
 gns3server/api/routes/controller/__init__.py | 8 ++++----
 gns3server/api/routes/controller/acl.py      | 6 +++---
 tests/api/routes/controller/test_acl.py      | 2 +-
 tests/api/routes/test_routes.py              | 4 ++--
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/gns3server/api/routes/controller/__init__.py b/gns3server/api/routes/controller/__init__.py
index 2898c786..28ad9b01 100644
--- a/gns3server/api/routes/controller/__init__.py
+++ b/gns3server/api/routes/controller/__init__.py
@@ -44,25 +44,25 @@ router.include_router(
 
 router.include_router(
     users.router,
-    prefix="/users",
+    prefix="/access/users",
     tags=["Users"]
 )
 
 router.include_router(
     groups.router,
-    prefix="/groups",
+    prefix="/access/groups",
     tags=["Users groups"]
 )
 
 router.include_router(
     roles.router,
-    prefix="/roles",
+    prefix="/access/roles",
     tags=["Roles"]
 )
 
 router.include_router(
     acl.router,
-    prefix="/acl",
+    prefix="/access/acl",
     tags=["ACL"]
 )
 
diff --git a/gns3server/api/routes/controller/acl.py b/gns3server/api/routes/controller/acl.py
index 763bb194..778ef51b 100644
--- a/gns3server/api/routes/controller/acl.py
+++ b/gns3server/api/routes/controller/acl.py
@@ -99,19 +99,19 @@ async def endpoints(
             )
 
     # users
-    add_to_endpoints("/users", "All users", "user")
+    add_to_endpoints("/access/users", "All users", "user")
     users = await users_repo.get_users()
     for user in users:
         add_to_endpoints(f"/users/{user.user_id}", f'User "{user.username}"', "user")
 
     # groups
-    add_to_endpoints("/groups", "All groups", "group")
+    add_to_endpoints("/access/groups", "All groups", "group")
     groups = await users_repo.get_user_groups()
     for group in groups:
         add_to_endpoints(f"/groups/{group.user_group_id}", f'Group "{group.name}"', "group")
 
     # roles
-    add_to_endpoints("/roles", "All roles", "role")
+    add_to_endpoints("/access/roles", "All roles", "role")
     roles = await rbac_repo.get_roles()
     for role in roles:
         add_to_endpoints(f"/roles/{role.role_id}", f'Role "{role.name}"', "role")
diff --git a/tests/api/routes/controller/test_acl.py b/tests/api/routes/controller/test_acl.py
index a5461d89..4524b2ee 100644
--- a/tests/api/routes/controller/test_acl.py
+++ b/tests/api/routes/controller/test_acl.py
@@ -62,7 +62,7 @@ class TestACLRoutes:
         rbac_repo = RbacRepository(db_session)
         admin_role_id = (await rbac_repo.get_role_by_name("Administrator")).role_id
         ace = ACECreate(
-            path="/acl",
+            path="/access/acl",
             ace_type="user",
             user_id=test_user.user_id,
             role_id=admin_role_id
diff --git a/tests/api/routes/test_routes.py b/tests/api/routes/test_routes.py
index f8bfb6e2..7a7313ed 100644
--- a/tests/api/routes/test_routes.py
+++ b/tests/api/routes/test_routes.py
@@ -29,8 +29,8 @@ ALLOWED_CONTROLLER_ENDPOINTS = [
     ("/static/web-ui/{file_path:path}", "GET"),
     ("/v3/version", "GET"),
     ("/v3/version", "POST"),
-    ("/v3/users/login", "POST"),
-    ("/v3/users/authenticate", "POST"),
+    ("/v3/access/users/login", "POST"),
+    ("/v3/access/users/authenticate", "POST"),
     ("/v3/symbols", "GET"),
     ("/v3/symbols/{symbol_id:path}/raw", "GET"),
     ("/v3/symbols/{symbol_id:path}/dimensions", "GET"),