1
0
Fork 0
mirror of synced 2024-06-27 18:40:42 +12:00

Merge branch 'master' of github.com:Budibase/budibase into fix/cypress-fixes

This commit is contained in:
mike12345567 2021-06-02 10:08:57 +01:00
commit 132f084ca5
21 changed files with 2669 additions and 76 deletions

View file

@ -61,13 +61,15 @@
- **Build and ship real software.** Unlike other platforms, with Budibase you build and ship single page applications. Budibase applications have performance baked in and can be designed responsively, providing your users with a great experience.
- **Open source and extensable.** Budibase is open-source. The builder is licensed AGPL v3, the server is GPL v3, and the client is MPL. This should fill you with confidence that Budibase will always be around. You can also code against Budibase or fork it and make changes as you please, providing a developer-friendly experience.
- **Open source and extensable.** Budibase is open-source - licensed as GPL v3. This should fill you with confidence that Budibase will always be around. You can also code against Budibase or fork it and make changes as you please, providing a developer-friendly experience.
- **Load data or start from scratch.** Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, mySQL, Airtable, Google Sheets, S3, DyanmoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no data sources. [Request new data sources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Load data or start from scratch.** Budibase pulls in data from multiple sources, including MongoDB, CouchDB, PostgreSQL, mySQL, Airtable, S3, DyanmoDB, or a REST API. And unlike other platforms, with Budibase you can start from scratch and create business apps with no data sources. [Request new data sources](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Design and build apps with powerful pre-made components.** Budibase comes out of the box with beautifully designed, powerful components which you can use like building blocks to build your UI. We also expose a lot of your favourite CSS styling options so you can go that extra creative mile. [Request new components](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Design and build apps with powerful pre-made components.** Budibase comes out of the box with beautifully designed, powerful components which you can use like building blocks to build your UI. We also expose a lot of your favourite CSS styling options so you can go that extra creative mile. [Request new component](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Automate processes, integrate with other tools, and connect to webhooks.** Save time by automating manual processes and workflows. From connecting to webhooks, to automating emails, simply tell Budibase what to do and let it work for you. You can easily [create new automations for Budibase here](https://github.com/Budibase/automations) or [request new integrations here](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Automate processes, integrate with other tools, and connect to webhooks.** Save time by automating manual processes and workflows. From connecting to webhooks, to automating emails, simply tell Budibase what to do and let it work for you. You can easily [create new automations for Budibase here](https://github.com/Budibase/automations) or [Request new automation](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).
- **Admin paradise.** Budibase is made to scale. With Budibase, you can self-host on your own infraastructure and globally manage users, onboarding, SMTP, apps, groups, theming and more. You can also provide users/groups with an app portal and disseminate user-management to the group manager.
<p align="center">
<img alt="Budibase design ui" src="https://i.imgur.com/5BnXPsN.png">
@ -80,7 +82,7 @@
## ⌛ Status
- [x] Alpha: We are demoing Budibase to users and receiving feedback
- [x] Private Beta: We are testing Budibase with a closed set of customers
- [x] Public Beta: Anyone can [sign-up and use Budibase](https://portal.budi.live/signup).
- [x] Public Beta: Anyone can [get started](https://docs.budibase.com/getting-started).
- [ ] Official Launch
Watch "releases" of this repo to get notified of major updates, and give the star button a click whilst you're there.

View file

@ -1,5 +1,5 @@
{
"version": "0.9.19",
"version": "0.9.21",
"npmClient": "yarn",
"packages": [
"packages/*"

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/auth",
"version": "0.9.19",
"version": "0.9.21",
"description": "Authentication middlewares for budibase builder and apps",
"main": "src/index.js",
"author": "Budibase",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.",
"version": "0.9.19",
"version": "0.9.21",
"license": "AGPL-3.0",
"svelte": "src/index.js",
"module": "dist/bbui.es.js",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/builder",
"version": "0.9.19",
"version": "0.9.21",
"license": "AGPL-3.0",
"private": true,
"scripts": {
@ -65,10 +65,10 @@
}
},
"dependencies": {
"@budibase/bbui": "^0.9.19",
"@budibase/client": "^0.9.19",
"@budibase/bbui": "^0.9.21",
"@budibase/client": "^0.9.21",
"@budibase/colorpicker": "1.1.2",
"@budibase/string-templates": "^0.9.19",
"@budibase/string-templates": "^0.9.21",
"@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/cli",
"version": "0.9.19",
"version": "0.9.21",
"description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js",
"bin": {

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/client",
"version": "0.9.19",
"version": "0.9.21",
"license": "MPL-2.0",
"module": "dist/budibase-client.js",
"main": "dist/budibase-client.js",
@ -18,13 +18,13 @@
"dev:builder": "rollup -cw"
},
"dependencies": {
"@budibase/string-templates": "^0.9.19",
"@budibase/string-templates": "^0.9.21",
"regexparam": "^1.3.0",
"shortid": "^2.2.15",
"svelte-spa-router": "^3.0.5"
},
"devDependencies": {
"@budibase/standard-components": "^0.9.19",
"@budibase/standard-components": "^0.9.21",
"@rollup/plugin-commonjs": "^18.0.0",
"@rollup/plugin-node-resolve": "^11.2.1",
"fs-extra": "^8.1.0",

View file

@ -0,0 +1,3 @@
module.exports = {
presets: [["@babel/preset-env", { targets: { node: "current" } }]],
}

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/server",
"email": "hi@budibase.com",
"version": "0.9.19",
"version": "0.9.21",
"description": "Budibase Web Server",
"main": "src/electron.js",
"repository": {
@ -55,9 +55,9 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.19",
"@budibase/client": "^0.9.19",
"@budibase/string-templates": "^0.9.19",
"@budibase/auth": "^0.9.21",
"@budibase/client": "^0.9.21",
"@budibase/string-templates": "^0.9.21",
"@elastic/elasticsearch": "7.10.0",
"@koa/router": "8.0.0",
"@sendgrid/mail": "7.1.1",
@ -107,8 +107,11 @@
"zlib": "1.0.5"
},
"devDependencies": {
"@budibase/standard-components": "^0.9.19",
"@babel/core": "^7.14.3",
"@babel/preset-env": "^7.14.4",
"@budibase/standard-components": "^0.9.21",
"@jest/test-sequencer": "^24.8.0",
"babel-jest": "^27.0.2",
"docker-compose": "^0.23.6",
"eslint": "^6.8.0",
"express": "^4.17.1",

View file

@ -27,7 +27,10 @@ const { cloneDeep } = require("lodash/fp")
const { processObject } = require("@budibase/string-templates")
const { getAllApps } = require("../../utilities")
const { USERS_TABLE_SCHEMA } = require("../../constants")
const { getDeployedApps } = require("../../utilities/workerRequests")
const {
getDeployedApps,
removeAppFromUserRoles,
} = require("../../utilities/workerRequests")
const { clientLibraryPath } = require("../../utilities")
const { getAllLocks } = require("../../utilities/redis")
@ -242,6 +245,8 @@ exports.delete = async function (ctx) {
if (!env.isTest()) {
await deleteApp(ctx.params.appId)
}
// make sure the app/role doesn't stick around after the app has been deleted
await removeAppFromUserRoles(ctx.params.appId)
ctx.status = 200
ctx.body = result

View file

@ -30,9 +30,9 @@ exports.save = async function (ctx) {
datasource._rev = response.rev
// Drain connection pools when configuration is changed
const pool = integrations[datasource.source].pool
if (pool) {
await pool.end()
const source = integrations[datasource.source]
if (source && source.pool) {
await source.pool.end()
}
ctx.status = 200

View file

@ -13,6 +13,7 @@ jest.mock("../../../../utilities/workerRequests", () => ({
_id: "us_uuid1",
}
}),
removeAppFromUserRoles: jest.fn(),
}))
exports.delay = ms => new Promise(resolve => setTimeout(resolve, ms))

View file

@ -5,7 +5,7 @@ jest.mock("../../environment", () => ({
prod: false,
isTest: () => true,
isProd: () => this.prod,
_set: (key, value) => {
_set: function(key, value) {
this.prod = value === "production"
}
})

View file

@ -91,7 +91,7 @@ describe("resourceId middleware", () => {
.mainResource("custom")
.subResource("customSub")
.build()
config = new TestConfiguration(middleware)
let config = new TestConfiguration(middleware)
config.setBody({
custom: "test",
customSub: "subtest"

View file

@ -57,11 +57,10 @@ exports.sendSmtpEmail = async (to, from, subject, contents) => {
})
)
const json = await response.json()
if (json.status !== 200 && response.status !== 200) {
if (response.status !== 200) {
throw "Unable to send email."
}
return json
return response.json()
}
exports.getDeployedApps = async ctx => {
@ -124,10 +123,10 @@ exports.getGlobalSelf = async (ctx, appId = null) => {
checkSlashesInUrl(env.WORKER_URL + endpoint),
request(ctx, { method: "GET" })
)
let json = await response.json()
if (json.status !== 200 && response.status !== 200) {
if (response.status !== 200) {
ctx.throw(400, "Unable to get self globally.")
}
let json = await response.json()
if (appId) {
json = getAppRole(appId, json)
}
@ -151,7 +150,7 @@ exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
...body,
roles: {
...user.roles,
[appId]: roleId,
[getDeployedAppID(appId)]: roleId,
},
}
const response = await fetch(
@ -161,9 +160,25 @@ exports.addAppRoleToUser = async (ctx, appId, roleId, userId = null) => {
body,
})
)
const json = await response.json()
if (json.status !== 200 && response.status !== 200) {
if (response.status !== 200) {
ctx.throw(400, "Unable to save self globally.")
}
return json
return response.json()
}
exports.removeAppFromUserRoles = async appId => {
const deployedAppId = getDeployedAppID(appId)
const response = await fetch(
checkSlashesInUrl(env.WORKER_URL + `/api/admin/roles/${deployedAppId}`),
request(null, {
method: "DELETE",
headers: {
"x-budibase-api-key": env.INTERNAL_API_KEY,
},
})
)
if (response.status !== 200) {
throw "Unable to remove app role"
}
return response.json()
}

File diff suppressed because it is too large Load diff

View file

@ -29,11 +29,11 @@
"keywords": [
"svelte"
],
"version": "0.9.19",
"version": "0.9.21",
"license": "MIT",
"gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc",
"dependencies": {
"@budibase/bbui": "^0.9.19",
"@budibase/bbui": "^0.9.21",
"@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1",
"apexcharts": "^3.22.1",

View file

@ -1,6 +1,6 @@
{
"name": "@budibase/string-templates",
"version": "0.9.19",
"version": "0.9.21",
"description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs",
"module": "dist/bundle.mjs",

View file

@ -1,7 +1,7 @@
{
"name": "@budibase/worker",
"email": "hi@budibase.com",
"version": "0.9.19",
"version": "0.9.21",
"description": "Budibase background service",
"main": "src/index.js",
"repository": {
@ -21,8 +21,8 @@
"author": "Budibase",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@budibase/auth": "^0.9.19",
"@budibase/string-templates": "^0.9.19",
"@budibase/auth": "^0.9.21",
"@budibase/string-templates": "^0.9.21",
"@koa/router": "^8.0.0",
"aws-sdk": "^2.811.0",
"bcryptjs": "^2.4.3",

View file

@ -11,6 +11,16 @@ const { sendEmail } = require("../../../utilities/email")
const GLOBAL_DB = StaticDatabases.GLOBAL.name
async function allUsers() {
const db = new CouchDB(GLOBAL_DB)
const response = await db.allDocs(
getGlobalUserParams(null, {
include_docs: true,
})
)
return response.rows.map(row => row.doc)
}
exports.save = async ctx => {
const db = new CouchDB(GLOBAL_DB)
const { email, password, _id } = ctx.request.body
@ -105,6 +115,23 @@ exports.destroy = async ctx => {
}
}
exports.removeAppRole = async ctx => {
const { appId } = ctx.params
const db = new CouchDB(GLOBAL_DB)
const users = await allUsers()
const bulk = []
for (let user of users) {
if (user.roles[appId]) {
delete user.roles[appId]
bulk.push(user)
}
}
await db.bulkDocs(bulk)
ctx.body = {
message: "App role removed from all users",
}
}
exports.getSelf = async ctx => {
ctx.params = {
id: ctx.user._id,
@ -134,13 +161,7 @@ exports.updateSelf = async ctx => {
// called internally by app server user fetch
exports.fetch = async ctx => {
const db = new CouchDB(GLOBAL_DB)
const response = await db.allDocs(
getGlobalUserParams(null, {
include_docs: true,
})
)
const users = response.rows.map(row => row.doc)
const users = await allUsers()
// user hashed password shouldn't ever be returned
for (let user of users) {
if (user) {

View file

@ -67,6 +67,7 @@ router
controller.save
)
.get("/api/admin/users", adminOnly, controller.fetch)
.delete("/api/admin/roles/:appId", adminOnly, controller.removeAppRole)
.delete("/api/admin/users/:id", adminOnly, controller.destroy)
.get("/api/admin/roles/:appId")
.post(