Skip to content

Commit

Permalink
Put user, groups, roles and ACL under /access
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Sep 2, 2023
1 parent a358369 commit 6ec97a7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions gns3server/api/routes/controller/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,25 @@

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"]
)

Expand Down
6 changes: 3 additions & 3 deletions gns3server/api/routes/controller/acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,19 +99,19 @@ def add_to_endpoints(endpoint: str, name: str, endpoint_type: str) -> None:
)

# 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")
Expand Down
2 changes: 1 addition & 1 deletion tests/api/routes/controller/test_acl.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async def test_create_ace(
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
Expand Down
4 changes: 2 additions & 2 deletions tests/api/routes/test_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
("/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"),
Expand Down

0 comments on commit 6ec97a7

Please sign in to comment.