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: add encrypt param to string attribute #5604

Merged
merged 42 commits into from
Aug 15, 2023

Conversation

2002Bishwajeet
Copy link
Contributor

@2002Bishwajeet 2002Bishwajeet commented May 30, 2023

What does this PR do?

Add and optional encrypt param to encrypt attributes

Test Plan

Unit and E2E testing

Related PRs and Issues

Fix #3150

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@2002Bishwajeet 2002Bishwajeet marked this pull request as ready for review June 21, 2023 10:47
Copy link
Contributor

@abnegate abnegate left a comment

Choose a reason for hiding this comment

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

Nice work

app/controllers/api/databases.php Outdated Show resolved Hide resolved
app/controllers/api/databases.php Outdated Show resolved Hide resolved
app/controllers/api/databases.php Outdated Show resolved Hide resolved
tests/e2e/Services/Databases/DatabasesCustomServerTest.php Outdated Show resolved Hide resolved
tests/e2e/Services/Databases/DatabasesCustomServerTest.php Outdated Show resolved Hide resolved
tests/e2e/Services/Databases/DatabasesCustomServerTest.php Outdated Show resolved Hide resolved
tests/e2e/Services/Databases/DatabasesCustomServerTest.php Outdated Show resolved Hide resolved
tests/e2e/Services/Databases/DatabasesCustomServerTest.php Outdated Show resolved Hide resolved
@abnegate abnegate requested a review from gewenyu99 June 23, 2023 08:56
Copy link
Member

@christyjacob4 christyjacob4 left a comment

Choose a reason for hiding this comment

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

Please address the comments

@2002Bishwajeet 2002Bishwajeet changed the title feat: add encrypt param to attributes feat: add encrypt param to string attribute Jul 12, 2023
safwanyp and others added 13 commits August 2, 2023 18:44
- cache caused stale data in memberships
This commit contains changes in 3 places.

- First I changed the placement of an informative comment in the DELETE TEAM controller, and moved it outside of the loop. I did this when Steven pointed out that the behaviour I describe in the comment is for the whole loop.

- The second change is the removal of my first test. I was facing quite a few issues with creating users in the test, and ended up using the CREATE TEAM MEMBERSHIP to perform 2 actions at once -> create a new user if one doesn't exist with the provided email, and create a membership for the user. Before this approach, I had quite a bit of code that didn't work, and it seems like I removed some things that weren't supposed to be removed, and didn't change variable names where necessary. Anyway, I figured that the problem has something to do with the user being created on the client side, so I moved the test to the server side.

- The new test I implemented does the same thing as my previous failed test, but in more detailed and distinct steps. The test first creates 5 new users inside of a loop, and pushes each new user's ID to an array called 'new_users' if the response is as expected. Then a new team is created. The next step is to create memberships for all 5 users. If all these steps pass, the new team that was just created, is deleted, and we check to make sure the new users have 0 team memberships each.

Formatter and linter showed no errors. Tests were successful on localhost.
The CREATE TEAM MEMBERSHIP endpoint requires the email of the user to be added to the team. If the user does not exist in the project, a new user is created with the specified email and added to the team.

The first version of the test creates 5 users, and then adds them to the newly created team. This process is more streamlined now, by using the CREATE TEAM MEMBERSHIPS behaviour to create a user on the go and create a membership for them immediately after.

I also change the way I add user IDs to the array, by using the shorthand notation instead of the `array_push` function.
Run the composer format and lint commands, which I forgot to run before.
…ail-template-missing-word

Added missing word to portuguese email template
…m-memberships-on-user

Fixed bug where memberships remained after a team is deleted
…pwrite-id-header-for-CreateFile

Validate value of x-appwrite-id header
@abnegate abnegate changed the base branch from master to 1.4.x August 8, 2023 19:13
@abnegate abnegate changed the base branch from 1.4.x to cl-1.4.x August 8, 2023 20:54
@abnegate abnegate changed the base branch from cl-1.4.x to 1.4.x August 8, 2023 21:27
@abnegate abnegate changed the base branch from 1.4.x to cl-1.4.x August 8, 2023 21:28
@abnegate abnegate changed the base branch from cl-1.4.x to feat-encrypt-string-attr August 9, 2023 03:00
@abnegate abnegate changed the base branch from feat-encrypt-string-attr to 1.4.x August 9, 2023 03:01
@abnegate abnegate changed the base branch from 1.4.x to cl-1.4.x August 9, 2023 03:02
app/controllers/api/databases.php Outdated Show resolved Hide resolved
@abnegate abnegate merged commit 171f22d into appwrite:cl-1.4.x Aug 15, 2023
3 checks passed
@2002Bishwajeet 2002Bishwajeet deleted the feat-add-encrypt-param branch August 15, 2023 03:30
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.

🚀 Feature: Encypted database fields
8 participants