-
Notifications
You must be signed in to change notification settings - Fork 148
Demo to create user profile document upon a new user account creation… #289
Demo to create user profile document upon a new user account creation… #289
Conversation
This PR is for issue #288 |
@eldadfux @adityaoberai - can you review this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requested a few changes
python/create_user_profile/main.py
Outdated
from appwrite.client import Client | ||
from appwrite.services.database import Database | ||
|
||
user_collection_id = "617497ffb09f7" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's store this in environment variable as it changes for everyone.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
python/create_user_profile/README.md
Outdated
## Introduction | ||
This function will be triggered at the new user account creation event. This will create the 'users' collection with the newly registered user's profile information. | ||
|
||
## Steps | ||
* Run below code to: | ||
* Point PIP target to .appwrite directory in the current working directory | ||
* Install appwrite library from requirements.txt | ||
``` | ||
PIP_TARGET=./.appwrite pip3 install -r ./requirements.txt --upgrade --ignore-installed | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use readme file from some of the existing functions and let's stick to it's structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
…ection id to env. var
…w-user-account-creation
Hi @Meldiron - suggested changes are implemented. Please take a look. |
python/create_user_profile/main.py
Outdated
client = init_client() | ||
database = Database(client) | ||
|
||
database.create_document(user_collection_id, {'user_id': userId, 'user_name': userName, 'email': email}, read=['*'], write=['*']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's give write permissions only to the user, otherwise hackers would remove them all 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Meldiron - removed the wildcard write permission.
As discussed with @Meldiron, keeping the access permission to "anyone to read" and "only owner to write".
Hello @Meldiron - can you check this pls? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
… - issue#288