diff --git a/packages/builder/vite.config.js b/packages/builder/vite.config.js
index 47fed87e1e..933a42a9d4 100644
--- a/packages/builder/vite.config.js
+++ b/packages/builder/vite.config.js
@@ -33,6 +33,9 @@ export default ({ mode }) => {
),
"process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL),
"process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN),
+ "process.env.FEATURE_PREVIEW_URL": JSON.stringify(
+ process.env.FEATURE_PREVIEW_URL
+ ),
}),
],
optimizeDeps: {
diff --git a/packages/frontend-core/src/api/other.js b/packages/frontend-core/src/api/other.js
index 6903a120db..e2cd7aac83 100644
--- a/packages/frontend-core/src/api/other.js
+++ b/packages/frontend-core/src/api/other.js
@@ -54,4 +54,13 @@ export const buildOtherEndpoints = API => ({
url: "/api/permission/builtin",
})
},
+
+ /**
+ * Check if they are part of the budibase beta program.
+ */
+ checkBetaAccess: async email => {
+ return await API.get({
+ url: `${process.env.FEATURE_PREVIEW_URL}/api/beta/access?email=${email}`,
+ })
+ },
})
diff --git a/packages/server/src/api/controllers/dev.js b/packages/server/src/api/controllers/dev.js
index 509089bed9..c1fe25ca20 100644
--- a/packages/server/src/api/controllers/dev.js
+++ b/packages/server/src/api/controllers/dev.js
@@ -3,8 +3,12 @@ const env = require("../../environment")
const { checkSlashesInUrl } = require("../../utilities")
const { request } = require("../../utilities/workerRequests")
const { clearLock } = require("../../utilities/redis")
-const { Replication, getProdAppID } = require("@budibase/backend-core/db")
-const { DocumentTypes } = require("../../db/utils")
+const {
+ Replication,
+ getProdAppID,
+ dangerousGetDB,
+} = require("@budibase/backend-core/db")
+const { DocumentTypes, getRowParams } = require("../../db/utils")
const { app: appCache } = require("@budibase/backend-core/cache")
const { getProdAppDB, getAppDB } = require("@budibase/backend-core/context")
@@ -125,3 +129,33 @@ exports.getBudibaseVersion = async ctx => {
version: require("../../../package.json").version,
}
}
+
+// TODO: remove as part of beta program
+exports.checkBetaAccess = async ctx => {
+ const userToCheck = ctx.query.email
+ // const BETA_USERS_DB = "app_bb_f9b77d06b9db4e3ca185476ab87a2364"
+ const TEST_BETA_USERS_DB = "app_de3eaf5d6a9849c3827e529bbf833813"
+ const BETA_USERS_TABLE = "ta_8c2c6df1c03f49cfb6340e85e066dd15"
+
+ try {
+ const db = dangerousGetDB(TEST_BETA_USERS_DB)
+ const betaUsers = (
+ await db.allDocs(
+ getRowParams(BETA_USERS_TABLE, null, {
+ include_docs: true,
+ })
+ )
+ ).rows.map(row => row.doc)
+
+ let access = false
+ for (let betaUser of betaUsers) {
+ if (betaUser["Email address"].trim() === userToCheck) {
+ access = true
+ break
+ }
+ }
+ ctx.body = { access }
+ } catch (err) {
+ ctx.body = { access: false }
+ }
+}
diff --git a/packages/server/src/api/routes/dev.js b/packages/server/src/api/routes/dev.js
index 165149ca8b..854e4f7035 100644
--- a/packages/server/src/api/routes/dev.js
+++ b/packages/server/src/api/routes/dev.js
@@ -22,5 +22,6 @@ router
.get("/api/dev/version", authorized(BUILDER), controller.getBudibaseVersion)
.delete("/api/dev/:appId/lock", authorized(BUILDER), controller.clearLock)
.post("/api/dev/:appId/revert", authorized(BUILDER), controller.revert)
+ .get("/api/beta/access", controller.checkBetaAccess)
module.exports = router
diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock
index aac4b695f8..775765e4e8 100644
--- a/packages/server/yarn.lock
+++ b/packages/server/yarn.lock
@@ -1014,10 +1014,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@budibase/backend-core@1.0.197":
- version "1.0.197"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.197.tgz#3458d70c6d44376b7930672d6af8c6e89ddf4069"
- integrity sha512-Cgzr1bJWKRg3+jqte7rnKPziWiH5Q+r/piRvHuD7EVmh2+xJLfWUz9iml72aFfcgRIOX8SyhejG7KTwxILx/vg==
+"@budibase/backend-core@1.0.198":
+ version "1.0.198"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.198.tgz#4b9a4dc4dabc73da31b5f95e38c6cfd2c87bfd09"
+ integrity sha512-IYTY3yuZQ0YVFy4v9zqX0L3ZhFowzY40DgthfbdCbdwHiaoLFpSi0+ynLHxholz3a7eCTcW6M5a3dHqy4kXtIQ==
dependencies:
"@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0"
@@ -1092,21 +1092,12 @@
svelte-flatpickr "^3.2.3"
svelte-portal "^1.0.0"
-<<<<<<< HEAD
-"@budibase/pro@1.0.192-alpha.1":
- version "1.0.192-alpha.1"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.192-alpha.1.tgz#f3dece7ee153ac81080be9f96c7459e5dd8510ff"
- integrity sha512-BRzoRTIcIW/o2bckSmOrOYCz5HPJyeq4PurfEZFHh16dXPXSBSTIuIiC7Q1jic2CBq5DJOfT/SYTgj/OTVga3g==
+"@budibase/pro@1.0.198":
+ version "1.0.198"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.198.tgz#b585e269e12317ede722e2b3814329bc63b60185"
+ integrity sha512-ow3R2MZZKwTsAZQ8knPQsVdzS28frAP5/csj0rW1O53mOsVu6K5LZLJMlZ72cLsLDZPHKtAku7Xgb+b+YWtbvA==
dependencies:
- "@budibase/backend-core" "1.0.192-alpha.1"
-=======
-"@budibase/pro@1.0.197":
- version "1.0.197"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.197.tgz#a171b46bb8ee6251881ae9262136270533b3958d"
- integrity sha512-SCVKjNgpzefmrXnLmkpQJLvYViykyzA6B9TwL7qrb6fBeXwAiSZ3hXGjNgZkVpy/v43hccPWt9BJFzFp457wgQ==
- dependencies:
- "@budibase/backend-core" "1.0.197"
->>>>>>> bd0ea6fd3ce54fc0f7f8774656d127a91771ea2d
+ "@budibase/backend-core" "1.0.198"
node-fetch "^2.6.1"
"@budibase/standard-components@^0.9.139":
diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock
index 977725108a..ab3baaf823 100644
--- a/packages/worker/yarn.lock
+++ b/packages/worker/yarn.lock
@@ -293,10 +293,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==
-"@budibase/backend-core@1.0.197":
- version "1.0.197"
- resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.197.tgz#3458d70c6d44376b7930672d6af8c6e89ddf4069"
- integrity sha512-Cgzr1bJWKRg3+jqte7rnKPziWiH5Q+r/piRvHuD7EVmh2+xJLfWUz9iml72aFfcgRIOX8SyhejG7KTwxILx/vg==
+"@budibase/backend-core@1.0.198":
+ version "1.0.198"
+ resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.198.tgz#4b9a4dc4dabc73da31b5f95e38c6cfd2c87bfd09"
+ integrity sha512-IYTY3yuZQ0YVFy4v9zqX0L3ZhFowzY40DgthfbdCbdwHiaoLFpSi0+ynLHxholz3a7eCTcW6M5a3dHqy4kXtIQ==
dependencies:
"@techpass/passport-openidconnect" "^0.3.0"
aws-sdk "^2.901.0"
@@ -322,12 +322,12 @@
uuid "^8.3.2"
zlib "^1.0.5"
-"@budibase/pro@1.0.197":
- version "1.0.197"
- resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.197.tgz#a171b46bb8ee6251881ae9262136270533b3958d"
- integrity sha512-SCVKjNgpzefmrXnLmkpQJLvYViykyzA6B9TwL7qrb6fBeXwAiSZ3hXGjNgZkVpy/v43hccPWt9BJFzFp457wgQ==
+"@budibase/pro@1.0.198":
+ version "1.0.198"
+ resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.198.tgz#b585e269e12317ede722e2b3814329bc63b60185"
+ integrity sha512-ow3R2MZZKwTsAZQ8knPQsVdzS28frAP5/csj0rW1O53mOsVu6K5LZLJMlZ72cLsLDZPHKtAku7Xgb+b+YWtbvA==
dependencies:
- "@budibase/backend-core" "1.0.197"
+ "@budibase/backend-core" "1.0.198"
node-fetch "^2.6.1"
"@cspotcode/source-map-consumer@0.8.0":