Merge pull request #3389 from Budibase/fix/sync-issue
Quick fix for sync issue
This commit is contained in:
commit
14c0dff29c
|
@ -97,6 +97,7 @@ exports.syncUser = async function (ctx) {
|
||||||
.map(([appId]) => appId)
|
.map(([appId]) => appId)
|
||||||
}
|
}
|
||||||
for (let prodAppId of prodAppIds) {
|
for (let prodAppId of prodAppIds) {
|
||||||
|
const roleId = roles[prodAppId]
|
||||||
const devAppId = getDevelopmentAppID(prodAppId)
|
const devAppId = getDevelopmentAppID(prodAppId)
|
||||||
for (let appId of [prodAppId, devAppId]) {
|
for (let appId of [prodAppId, devAppId]) {
|
||||||
if (!(await doesDatabaseExist(appId))) {
|
if (!(await doesDatabaseExist(appId))) {
|
||||||
|
@ -115,17 +116,21 @@ exports.syncUser = async function (ctx) {
|
||||||
tableId: InternalTables.USER_METADATA,
|
tableId: InternalTables.USER_METADATA,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let combined
|
// assign the roleId for the metadata doc
|
||||||
if (deleting) {
|
if (roleId) {
|
||||||
combined = {
|
metadata.roleId = roleId
|
||||||
...metadata,
|
}
|
||||||
status: UserStatus.INACTIVE,
|
let combined = !deleting
|
||||||
metadata: BUILTIN_ROLE_IDS.PUBLIC,
|
? combineMetadataAndUser(user, metadata)
|
||||||
}
|
: {
|
||||||
} else {
|
...metadata,
|
||||||
combined = combineMetadataAndUser(user, metadata)
|
status: UserStatus.INACTIVE,
|
||||||
|
metadata: BUILTIN_ROLE_IDS.PUBLIC,
|
||||||
|
}
|
||||||
|
// if its null then there was no updates required
|
||||||
|
if (combined) {
|
||||||
|
await db.put(combined)
|
||||||
}
|
}
|
||||||
await db.put(combined)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.body = {
|
ctx.body = {
|
||||||
|
|
Loading…
Reference in New Issue