1
0
Fork 0
mirror of synced 2024-08-04 21:02:01 +12:00
budibase/packages/server/utilities/budibaseApi.js

41 lines
800 B
JavaScript
Raw Normal View History

2019-06-08 01:18:10 +12:00
const crypto = require("../nodeCrypto");
2019-06-14 21:05:46 +12:00
const {getAppApis} = require("budibase-core");
2019-06-08 01:18:10 +12:00
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;
}
2019-06-15 04:01:01 +12:00
module.exports.getApisForSession = async (datastore, session) => {
2019-06-14 21:05:46 +12:00
const user = JSON.parse(session.user_json);
const bb = await getAppApis(
datastore,
null, null, null,
crypto
);
bb.asUser(user);
return bb;
}