Skip to content

Commit

Permalink
Deployment from App Services
Browse files Browse the repository at this point in the history
  • Loading branch information
mongodb-atlas-app-services[bot] authored Jun 6, 2024
1 parent 432d955 commit c33dc39
Show file tree
Hide file tree
Showing 19 changed files with 181 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/app/data-enquc/.mdb/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"config_version": 20210101,
"app_id": "65a54653ac3e07263900a89a",
"group_id": "656405b98ff1580b1462f081",
"client_app_id": "data-enquc",
"last_pulled": 0
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/auth/custom_user_data.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enabled": false
}
18 changes: 18 additions & 0 deletions src/app/data-enquc/auth/providers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"api-key": {
"name": "api-key",
"type": "api-key",
"disabled": false
},
"local-userpass": {
"name": "local-userpass",
"type": "local-userpass",
"disabled": false,
"config": {
"autoConfirm": true,
"resetFunctionName": "resetFunc",
"runConfirmationFunction": false,
"runResetFunction": true
}
}
}
10 changes: 10 additions & 0 deletions src/app/data-enquc/data_sources/AtlasCluster/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "AtlasCluster",
"type": "mongodb-atlas",
"config": {
"clusterName": "AtlasCluster",
"readPreference": "primary",
"wireProtocolEnabled": false
},
"version": 1
}
13 changes: 13 additions & 0 deletions src/app/data-enquc/data_sources/AtlasCluster/default_rule.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"roles": [
{
"name": "readAndWriteAll",
"apply_when": {},
"insert": true,
"delete": true,
"search": true,
"read": true,
"write": true
}
]
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/environments/development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": {}
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/environments/no-environment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": {}
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/environments/production.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": {}
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/environments/qa.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": {}
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/environments/testing.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"values": {}
}
6 changes: 6 additions & 0 deletions src/app/data-enquc/functions/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"name": "resetFunc",
"private": false
}
]
69 changes: 69 additions & 0 deletions src/app/data-enquc/functions/resetFunc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
This function will be run when the client SDK 'callResetPasswordFunction' is called with an object parameter that
contains five keys: 'token', 'tokenId', 'username', 'password', and 'currentPasswordValid'.
'currentPasswordValid' is a boolean will be true if a user changes their password by entering their existing
password and the password matches the actual password that is stored. Additional parameters are passed in as part
of the argument list from the SDK.
The return object must contain a 'status' key which can be empty or one of three string values:
'success', 'pending', or 'fail'
'success': the user's password is set to the passed in 'password' parameter.
'pending': the user's password is not reset and the UserPasswordAuthProviderClient 'resetPassword' function would
need to be called with the token, tokenId, and new password via an SDK. (see below)
const Realm = require("realm");
const appConfig = {
id: "my-app-id",
timeout: 1000,
app: {
name: "my-app-name",
version: "1"
}
};
let app = new Realm.App(appConfig);
let client = app.auth.emailPassword;
await client.resetPassword(token, tokenId, newPassword);
'fail': the user's password is not reset and will not be able to log in with that password.
If an error is thrown within the function the result is the same as 'fail'.
Example below:
exports = (
{ token, tokenId, username, password, currentPasswordValid },
sendEmail,
securityQuestionAnswer
) => {
// process the reset token, tokenId, username and password
if (sendEmail) {
context.functions.execute(
"sendResetPasswordEmail",
username,
token,
tokenId
);
// will wait for SDK resetPassword to be called with the token and tokenId
return { status: "pending" };
} else if (
context.functions.execute(
"validateSecurityQuestionAnswer",
username,
securityQuestionAnswer || currentPasswordValid
)
) {
// will set the users password to the password parameter
return { status: "success" };
}
The uncommented function below is just a placeholder and will result in failure.
*/

exports = ({ token, tokenId, username, password }) => {
console.log("Please visit the App Services UI to fully configure your password reset function");
// will not reset the password
return { status: 'fail' };
};
4 changes: 4 additions & 0 deletions src/app/data-enquc/graphql/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"use_natural_pluralization": true,
"disable_schema_introspection": false
}
6 changes: 6 additions & 0 deletions src/app/data-enquc/graphql/validation_settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"read_validation_action": "ERROR",
"read_validation_level": "STRICT",
"write_validation_action": "ERROR",
"write_validation_level": "STRICT"
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/hosting/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"enabled": false
}
1 change: 1 addition & 0 deletions src/app/data-enquc/http_endpoints/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
15 changes: 15 additions & 0 deletions src/app/data-enquc/http_endpoints/data_api_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"versions": [
"v1"
],
"run_as_user_id": "",
"run_as_user_id_script_source": "",
"can_evaluate": {},
"log_function_arguments": true,
"disabled": false,
"validation_method": "NO_VALIDATION",
"secret_name": "",
"fetch_custom_user_data": false,
"create_user_on_auth": true,
"return_type": "JSON"
}
8 changes: 8 additions & 0 deletions src/app/data-enquc/realm_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"app_id": "data-enquc",
"config_version": 20210101,
"name": "data",
"provider_region": "aws-us-east-1",
"deployment_model": "GLOBAL",
"environment": "production"
}
3 changes: 3 additions & 0 deletions src/app/data-enquc/sync/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"development_mode_enabled": false
}

0 comments on commit c33dc39

Please sign in to comment.