diff --git a/app-1/auth/custom_user_data.json b/app-1/auth/custom_user_data.json index a82d0fb..4674363 100644 --- a/app-1/auth/custom_user_data.json +++ b/app-1/auth/custom_user_data.json @@ -1,3 +1,8 @@ { - "enabled": false + "enabled": true, + "mongo_service_name": "mongodb-atlas", + "database_name": "db", + "collection_name": "Database", + "user_id_field": "Clusters", + "on_user_creation_function_name": "onUserCreation" } diff --git a/app-1/functions/config.json b/app-1/functions/config.json index b3356b2..53eb92f 100644 --- a/app-1/functions/config.json +++ b/app-1/functions/config.json @@ -2,5 +2,9 @@ { "name": "resetFunc", "private": true + }, + { + "name": "onUserCreation", + "private": false } ] diff --git a/app-1/functions/onUserCreation.js b/app-1/functions/onUserCreation.js new file mode 100644 index 0000000..18a8a7d --- /dev/null +++ b/app-1/functions/onUserCreation.js @@ -0,0 +1,19 @@ +/* + This function will run after a user is created and is called with an object representing that user. + + This function runs as a System user and has full access to Services, Functions, and MongoDB Data. + + Example below: + + exports = (user) => { + // use collection that Custom User Data is configured on + const collection = context.services.get("").db("").collection(""); + + // insert custom data into collection, using the user id field that Custom User Data is configured on + const doc = collection.insertOne({ : user.id, name: user.data.name }); + }; +*/ + +exports = (user) => { + return; +}; diff --git a/app-1/functions/package.json b/app-1/functions/package.json new file mode 100644 index 0000000..9e7783b --- /dev/null +++ b/app-1/functions/package.json @@ -0,0 +1 @@ +{"dependencies":{"Npm":"3.0.0"}} \ No newline at end of file