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