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

Feat: update user data privacy #311

Merged
merged 9 commits into from
Aug 8, 2024

Conversation

Ajinx1
Copy link
Contributor

@Ajinx1 Ajinx1 commented Aug 8, 2024

Description

This pull request introduces a new API endpoint to update a user's data privacy settings.

Key Features

  • Endpoint: PUT /api/v1/users/{user_id}/data-privacy-settings
  • Functionality: Updates data privacy settings for a specified user.
  • Authentication: Requires a valid JWT token for access.
  • Authorization: Only users with the SuperAdmin role can update other users' data privacy settings. Regular users can update their own settings.

API DOC HERE

Acceptance Criteria

  • The endpoint should accept HTTP PUT requests with a JSON payload.
  • The request must include a valid authentication token in the Authorization header.
  • The request body should contain the data privacy settings to be updated.
  • The response should confirm the successful update of data privacy settings for the specified user if the user is authorized.

Authorization Header:

{
    "Authorization": "Bearer <token>"
}

Request Body Example:

{
    "profile_visibility": false,
    "share_data_with_partners": false,
    "receive_email_updates": false,
    "enable_2fa": true,
    "use_data_encryption": false,
    "allow_analytics": true,
    "personalized_ads": true
}

Related Issue

This pull request addresses Issue 309.

How Has This Been Tested?

The changes have been tested with the following methods:

  • Integration Tests:
    • Verified successful update of data privacy settings by an authorized SuperAdmin user for other users.
    • Tested successful update of own data privacy settings by a regular user.
    • Tested unauthorized access attempts with an invalid token.
    • Handled cases where a regular user attempts to update another user's data privacy settings.

Screenshots (if appropriate - Postman, etc.)

image
image
image
image

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Contributor

@Cyberguru1 Cyberguru1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Cyberguru1 Cyberguru1 merged commit 4b9a107 into hngprojects:dev Aug 8, 2024
4 of 5 checks passed
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.

2 participants