Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cyberstorm api create/delete service account (TS-2320) #1098

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Roffenlund
Copy link
Contributor

@Roffenlund Roffenlund commented Feb 14, 2025

This pull request implements the following:

  • CreateServiceAccountAPIView: Handles the creation of service accounts with team-specific permission checks, ensuring that only authorized users can create service accounts for a given team.

  • DeleteServiceAccountAPIView: Manages the deletion of service accounts, enforcing team-based permissions to ensure that only users with the right access can delete service accounts for a team.

  • TeamPermissionMixin: A mixin class that centralizes the logic for permission checks based on team access. It ensures that users are authorized to perform actions on service accounts for the specified team.

@Roffenlund Roffenlund force-pushed the cyberstorm-api-create-service-account branch from f59e764 to 7580d68 Compare February 14, 2025 12:49
@Roffenlund Roffenlund changed the title Cyberstorm api create service account (TS-2320) Cyberstorm api create/data service account (TS-2320) Feb 14, 2025
@Roffenlund Roffenlund changed the title Cyberstorm api create/data service account (TS-2320) Cyberstorm api create/delete service account (TS-2320) Feb 14, 2025
@Roffenlund Roffenlund requested a review from x753 February 14, 2025 14:27
@Roffenlund Roffenlund requested a review from x753 February 17, 2025 14:54
@Roffenlund Roffenlund requested a review from x753 February 18, 2025 09:05
@Roffenlund Roffenlund force-pushed the cyberstorm-api-create-service-account branch from 9e7246d to d1f1098 Compare February 18, 2025 15:42
Implement a serializer for creating service accounts, and a serializer
for deleting service accounts. Two of the fields in the serializer
intended for creating service accounts are read-only, as they are only
required in the response from the view.

Refs. TS-2320
Added CreateServiceAccountAPIView and DeleteServiceAccountAPIView to
manage service account creation and deletion with team-specific permission checks.

Introduced TeamPermissionMixin to handle permission checks for users
based on team access and actions on service accounts.

Both views enforce team-based access control, ensuring users have
the appropriate permissions to create or delete service accounts for the given team.

Refs. TS-2320
Rename team_id to team_name in the kwargs for the create/delete
service account endpoints.

Refs. TS-2320
- Inherit DestroyAPIView in DeleteServiceAccountAPIView.
- Use delete() instead of post() for deleting service accounts.
- Add uuid to URL instead of sending a payload to the DELETE endpoint.
- Update tests accordingly.

Refs. TS-2320
@Roffenlund Roffenlund force-pushed the cyberstorm-api-create-service-account branch from d1f1098 to a5fa14c Compare February 20, 2025 12:34
Add missing parameter whe calling the ServiceAccount's .create function.
Error raised after rebase.

Refs. TS-2320
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants