|
|
@ -27,15 +27,19 @@ exports.defaultHeaders = appId => { |
|
|
const builderUser = { |
|
|
const builderUser = { |
|
|
userId: "BUILDER", |
|
|
userId: "BUILDER", |
|
|
accessLevelId: BUILDER_LEVEL_ID, |
|
|
accessLevelId: BUILDER_LEVEL_ID, |
|
|
appId, |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const builderToken = jwt.sign(builderUser, env.JWT_SECRET) |
|
|
const builderToken = jwt.sign(builderUser, env.JWT_SECRET) |
|
|
|
|
|
|
|
|
return { |
|
|
const headers = { |
|
|
Accept: "application/json", |
|
|
Accept: "application/json", |
|
|
Cookie: [`budibase:builder=${builderToken}:local`], |
|
|
Cookie: [`budibase:builder:local=${builderToken}`], |
|
|
|
|
|
} |
|
|
|
|
|
if (appId) { |
|
|
|
|
|
headers["x-budibase-app-id"] = appId |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return headers |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
exports.createTable = async (request, appId, table) => { |
|
|
exports.createTable = async (request, appId, table) => { |
|
|
@ -209,7 +213,10 @@ const createUserWithPermissions = async ( |
|
|
|
|
|
|
|
|
const loginResult = await request |
|
|
const loginResult = await request |
|
|
.post(`/api/authenticate`) |
|
|
.post(`/api/authenticate`) |
|
|
.set({ Cookie: `budibase:${appId}:local=${anonToken}` }) |
|
|
.set({ |
|
|
|
|
|
Cookie: `budibase:${appId}:local=${anonToken}`, |
|
|
|
|
|
"x-budibase-app-id": appId, |
|
|
|
|
|
}) |
|
|
.send({ username, password }) |
|
|
.send({ username, password }) |
|
|
|
|
|
|
|
|
// returning necessary request headers
|
|
|
// returning necessary request headers
|
|
|
|