Skip to content

Commit

Permalink
Remove privileges endpoint from roles
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Sep 14, 2023
1 parent 63c1def commit 7534718
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
17 changes: 0 additions & 17 deletions gns3server/api/routes/controller/roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,23 +81,6 @@ async def create_role(
return await rbac_repo.create_role(role_create)


@router.get(
"/privileges",
response_model=List[schemas.Privilege],
dependencies=[Depends(has_privilege("Role.Audit"))]
)
async def get_privileges(
rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)),
) -> List[schemas.Privilege]:
"""
Get all available privileges.
Required privilege: Role.Audit
"""

return await rbac_repo.get_privileges()


@router.get(
"/{role_id}",
response_model=schemas.Role,
Expand Down
6 changes: 0 additions & 6 deletions tests/api/routes/controller/test_roles.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,6 @@ async def test_get_role(self, app: FastAPI, client: AsyncClient, db_session: Asy
assert response.status_code == status.HTTP_200_OK
assert response.json()["role_id"] == str(role_in_db.role_id)

async def test_get_privileges(self, app: FastAPI, client: AsyncClient):

response = await client.get(app.url_path_for("get_privileges"))
assert response.status_code == status.HTTP_200_OK
assert len(response.json()) == 45 # 45 built-in privileges

async def test_list_roles(self, app: FastAPI, client: AsyncClient) -> None:

response = await client.get(app.url_path_for("get_roles"))
Expand Down

0 comments on commit 7534718

Please sign in to comment.