Formatting.

This commit is contained in:
mike12345567 2021-05-14 16:32:51 +01:00
parent c45fdefb48
commit ac0f620b38
9 changed files with 16 additions and 21 deletions

View File

@ -147,7 +147,9 @@ exports.getRoleParams = (roleId = null, otherProps = {}) => {
exports.getAllApps = async (devApps = false) => { exports.getAllApps = async (devApps = false) => {
const CouchDB = getCouch() const CouchDB = getCouch()
let allDbs = await CouchDB.allDbs() 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)) const appPromises = appDbNames.map(db => new CouchDB(db).get(db))
if (appPromises.length === 0) { if (appPromises.length === 0) {
return [] return []

View File

@ -1,7 +1,12 @@
const { getDB } = require("../db") const { getDB } = require("../db")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")
const { BUILTIN_PERMISSION_IDS, higherPermission } = require("./permissions") 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 = { const BUILTIN_IDS = {
ADMIN: "ADMIN", ADMIN: "ADMIN",
@ -153,7 +158,7 @@ async function getAllUserRoles(appId, userRoleId) {
currentRole && currentRole &&
currentRole.inherits && currentRole.inherits &&
roleIds.indexOf(currentRole.inherits) === -1 roleIds.indexOf(currentRole.inherits) === -1
) { ) {
roleIds.push(currentRole.inherits) roleIds.push(currentRole.inherits)
currentRole = await exports.getRole(appId, currentRole.inherits) currentRole = await exports.getRole(appId, currentRole.inherits)
roles.push(currentRole) roles.push(currentRole)

View File

@ -20,10 +20,7 @@ const {
DocumentTypes, DocumentTypes,
AppStatus, AppStatus,
} = require("../../db/utils") } = require("../../db/utils")
const { const { BUILTIN_ROLE_IDS, AccessController } = require("@budibase/auth/roles")
BUILTIN_ROLE_IDS,
AccessController,
} = require("@budibase/auth/roles")
const { BASE_LAYOUTS } = require("../../constants/layouts") const { BASE_LAYOUTS } = require("../../constants/layouts")
const { const {
createHomeScreen, createHomeScreen,

View File

@ -1,10 +1,7 @@
const Router = require("@koa/router") const Router = require("@koa/router")
const controller = require("../controllers/permission") const controller = require("../controllers/permission")
const authorized = require("../../middleware/authorized") const authorized = require("../../middleware/authorized")
const { const { BUILDER, PermissionLevels } = require("@budibase/auth/permissions")
BUILDER,
PermissionLevels,
} = require("@budibase/auth/permissions")
const Joi = require("joi") const Joi = require("joi")
const joiValidator = require("../../middleware/joi-validator") const joiValidator = require("../../middleware/joi-validator")

View File

@ -14,7 +14,7 @@ exports.getAllTableRows = async config => {
} }
exports.clearAllApps = async () => { exports.clearAllApps = async () => {
const req = { query: { status: "dev"} } const req = { query: { status: "dev" } }
await appController.fetch(req) await appController.fetch(req)
const apps = req.body const apps = req.body
if (!apps || apps.length <= 0) { if (!apps || apps.length <= 0) {

View File

@ -1,7 +1,5 @@
const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles") const { BUILTIN_ROLE_IDS } = require("@budibase/auth/roles")
const { const { BUILTIN_PERMISSION_IDS } = require("@budibase/auth/permissions")
BUILTIN_PERMISSION_IDS,
} = require("@budibase/auth/permissions")
const { createHomeScreen } = require("../../constants/screens") const { createHomeScreen } = require("../../constants/screens")
const { EMPTY_LAYOUT } = require("../../constants/layouts") const { EMPTY_LAYOUT } = require("../../constants/layouts")
const { cloneDeep } = require("lodash/fp") const { cloneDeep } = require("lodash/fp")

View File

@ -4,10 +4,7 @@ const {
getBuiltinPermissionByID, getBuiltinPermissionByID,
isPermissionLevelHigherThanRead, isPermissionLevelHigherThanRead,
} = require("@budibase/auth/permissions") } = require("@budibase/auth/permissions")
const { const { lowerBuiltinRoleID, getBuiltinRoles } = require("@budibase/auth/roles")
lowerBuiltinRoleID,
getBuiltinRoles,
} = require("@budibase/auth/roles")
const { DocumentTypes } = require("../db/utils") const { DocumentTypes } = require("../db/utils")
const CURRENTLY_SUPPORTED_LEVELS = [ const CURRENTLY_SUPPORTED_LEVELS = [

View File

@ -19,6 +19,6 @@ exports.fetch = async ctx => {
exports.find = async ctx => { exports.find = async ctx => {
const appId = ctx.params.appId const appId = ctx.params.appId
ctx.body = { ctx.body = {
roles: await getAllRoles(appId) roles: await getAllRoles(appId),
} }
} }

View File

@ -3,7 +3,6 @@ const controller = require("../../controllers/admin/roles")
const router = Router() const router = Router()
router router
.get("/api/admin/roles", controller.fetch) .get("/api/admin/roles", controller.fetch)
.get("/api/admin/roles/:appId", controller.find) .get("/api/admin/roles/:appId", controller.find)