1
0
Fork 0
mirror of synced 2024-07-12 17:56:07 +12:00
budibase/initialise/helpers.js

30 lines
748 B
JavaScript
Raw Normal View History

2019-04-06 04:30:29 +13:00
const crypto = require("../server/nodeCrypto");
2019-06-07 23:02:48 +12:00
const {getDatabaseManager, getAppApis} = require("budibase-core");
2019-04-06 04:30:29 +13:00
module.exports.getApisWithFullAccess = async (datastore) => {
const bb = await getAppApis(
datastore,
null, null, null,
crypto
);
2019-06-07 23:02:48 +12:00
bb.withFullAccess();
2019-04-06 04:30:29 +13:00
return bb;
};
2019-06-07 23:02:48 +12:00
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.getDatabaseManager = (datastoreModule, datastoreConfig) =>
getDatabaseManager(datastoreModule.databaseManager(datastoreConfig));