Budibase is an open-source low-code platform for creating internal apps in minutes. Supports PostgreSQL, MySQL, MSSQL, MongoDB, Rest API, Docker, K8s 🚀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

19 lines
657 B

module.exports = ({ masterAppInternal, instanceKey, app }) => async ({
user,
}) => {
const { bbMaster } = masterAppInternal
const existingUser = await masterAppInternal.getUser(app.id, user.name)
if (existingUser) return
const masterUser = bbMaster.recordApi.getNew(`${app.key}/users`, "user")
masterUser.name = user.name
bbMaster.recordApi.setCustomId(masterUser, masterUser.name)
masterUser.createdByMaster = false
masterUser.instance = await bbMaster.recordApi.load(instanceKey)
masterUser.active = user.enabled
await bbMaster.recordApi.save(masterUser)
}
exports.timeout = ms => new Promise(resolve => setTimeout(resolve, ms))