From ac0f620b385a2d545d1aa71f74e1b5cfea5e7cc3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 14 May 2021 16:32:51 +0100 Subject: [PATCH] Formatting. --- packages/auth/src/db/utils.js | 4 +++- packages/auth/src/security/roles.js | 9 +++++++-- packages/server/src/api/controllers/application.js | 5 +---- packages/server/src/api/routes/permission.js | 5 +---- .../src/api/routes/tests/utilities/TestFunctions.js | 2 +- packages/server/src/tests/utilities/structures.js | 4 +--- packages/server/src/utilities/security.js | 5 +---- packages/worker/src/api/controllers/admin/roles.js | 2 +- packages/worker/src/api/routes/admin/roles.js | 1 - 9 files changed, 16 insertions(+), 21 deletions(-) diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index ecb11824bd..f065f9f89a 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -147,7 +147,9 @@ exports.getRoleParams = (roleId = null, otherProps = {}) => { exports.getAllApps = async (devApps = false) => { const CouchDB = getCouch() let allDbs = await CouchDB.allDbs() - const appDbNames = allDbs.filter(dbName => dbName.startsWith(exports.APP_PREFIX)) + const appDbNames = allDbs.filter(dbName => + dbName.startsWith(exports.APP_PREFIX) + ) const appPromises = appDbNames.map(db => new CouchDB(db).get(db)) if (appPromises.length === 0) { return [] diff --git a/packages/auth/src/security/roles.js b/packages/auth/src/security/roles.js index d88be96b2c..d652c25b00 100644 --- a/packages/auth/src/security/roles.js +++ b/packages/auth/src/security/roles.js @@ -1,7 +1,12 @@ const { getDB } = require("../db") const { cloneDeep } = require("lodash/fp") const { BUILTIN_PERMISSION_IDS, higherPermission } = require("./permissions") -const { generateRoleID, getRoleParams, DocumentTypes, SEPARATOR } = require("../db/utils") +const { + generateRoleID, + getRoleParams, + DocumentTypes, + SEPARATOR, +} = require("../db/utils") const BUILTIN_IDS = { ADMIN: "ADMIN", @@ -153,7 +158,7 @@ async function getAllUserRoles(appId, userRoleId) { currentRole && currentRole.inherits && roleIds.indexOf(currentRole.inherits) === -1 - ) { + ) { roleIds.push(currentRole.inherits) currentRole = await exports.getRole(appId, currentRole.inherits) roles.push(currentRole) diff --git a/packages/server/src/api/controllers/application.js b/packages/server/src/api/controllers/application.js index cdc3c59a52..b9485a3ac4 100644 --- a/packages/server/src/api/controllers/application.js +++ b/packages/server/src/api/controllers/application.js @@ -20,10 +20,7 @@ const { DocumentTypes, AppStatus, } = require("../../db/utils") -const { - BUILTIN_ROLE_IDS, - AccessController, -} = require("@budibase/auth/roles") +const { BUILTIN_ROLE_IDS, AccessController } = require("@budibase/auth/roles") const { BASE_LAYOUTS } = require("../../constants/layouts") const { createHomeScreen, diff --git a/packages/server/src/api/routes/permission.js b/packages/server/src/api/routes/permission.js index 898e8fa1d7..f395b13577 100644 --- a/packages/server/src/api/routes/permission.js +++ b/packages/server/src/api/routes/permission.js @@ -1,10 +1,7 @@ const Router = require("@koa/router") const controller = require("../controllers/permission") const authorized = require("../../middleware/authorized") -const { - BUILDER, - PermissionLevels, -} = require("@budibase/auth/permissions") +const { BUILDER, PermissionLevels } = require("@budibase/auth/permissions") const Joi = require("joi") const joiValidator = require("../../middleware/joi-validator") diff --git a/packages/server/src/api/routes/tests/utilities/TestFunctions.js b/packages/server/src/api/routes/tests/utilities/TestFunctions.js index d2139e2780..cbb7d59ce2 100644 --- a/packages/server/src/api/routes/tests/utilities/TestFunctions.js +++ b/packages/server/src/api/routes/tests/utilities/TestFunctions.js @@ -14,7 +14,7 @@ exports.getAllTableRows = async config => { } exports.clearAllApps = async () => { - const req = { query: { status: "dev"} } + const req = { query: { status: "dev" } } await appController.fetch(req) const apps = req.body if (!apps || apps.length <= 0) { diff --git a/packages/server/src/tests/utilities/structures.js b/packages/server/src/tests/utilities/structures.js index 08647f4a08..e925c272ac 100644 --- a/packages/server/src/tests/utilities/structures.js +++ b/packages/server/src/tests/utilities/structures.js @@ -1,7 +1,5 @@ const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") -const { - BUILTIN_PERMISSION_IDS, -} = require("@budibase/auth/permissions") +const { BUILTIN_PERMISSION_IDS } = require("@budibase/auth/permissions") const { createHomeScreen } = require("../../constants/screens") const { EMPTY_LAYOUT } = require("../../constants/layouts") const { cloneDeep } = require("lodash/fp") diff --git a/packages/server/src/utilities/security.js b/packages/server/src/utilities/security.js index dca6a60a98..78b2f5b713 100644 --- a/packages/server/src/utilities/security.js +++ b/packages/server/src/utilities/security.js @@ -4,10 +4,7 @@ const { getBuiltinPermissionByID, isPermissionLevelHigherThanRead, } = require("@budibase/auth/permissions") -const { - lowerBuiltinRoleID, - getBuiltinRoles, -} = require("@budibase/auth/roles") +const { lowerBuiltinRoleID, getBuiltinRoles } = require("@budibase/auth/roles") const { DocumentTypes } = require("../db/utils") const CURRENTLY_SUPPORTED_LEVELS = [ diff --git a/packages/worker/src/api/controllers/admin/roles.js b/packages/worker/src/api/controllers/admin/roles.js index 30c44a9b18..3bb5647ca7 100644 --- a/packages/worker/src/api/controllers/admin/roles.js +++ b/packages/worker/src/api/controllers/admin/roles.js @@ -19,6 +19,6 @@ exports.fetch = async ctx => { exports.find = async ctx => { const appId = ctx.params.appId ctx.body = { - roles: await getAllRoles(appId) + roles: await getAllRoles(appId), } } diff --git a/packages/worker/src/api/routes/admin/roles.js b/packages/worker/src/api/routes/admin/roles.js index 8595662ac3..3e14eb0601 100644 --- a/packages/worker/src/api/routes/admin/roles.js +++ b/packages/worker/src/api/routes/admin/roles.js @@ -3,7 +3,6 @@ const controller = require("../../controllers/admin/roles") const router = Router() - router .get("/api/admin/roles", controller.fetch) .get("/api/admin/roles/:appId", controller.find)