1
0
Fork 0
mirror of synced 2024-07-12 17:56:07 +12:00
budibase/packages/server/utilities/budibaseApi.js
2019-06-14 10:05:46 +01:00

41 lines
789 B
JavaScript

const crypto = require("../nodeCrypto");
const {getAppApis} = require("budibase-core");
module.exports.getApisWithFullAccess = async (datastore) => {
const bb = await getAppApis(
datastore,
null, null, null,
crypto
);
bb.withFullAccess();
return bb;
};
module.exports.getApisForUser = async (datastore, username, password) => {
const bb = await getAppApis(
datastore,
null, null, null,
crypto
);
await bb.authenticateAs(username, password);
return bb;
}
module.exports.getApisForSession = async (session) => {
const user = JSON.parse(session.user_json);
const bb = await getAppApis(
datastore,
null, null, null,
crypto
);
bb.asUser(user);
return bb;
}