Adding role, as it wasn't being set in metadata.

This commit is contained in:
mike12345567 2021-11-15 16:46:56 +00:00
parent ce47eb6cff
commit 0f54787072
1 changed files with 5 additions and 0 deletions

View File

@ -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,6 +116,10 @@ exports.syncUser = async function (ctx) {
tableId: InternalTables.USER_METADATA, tableId: InternalTables.USER_METADATA,
} }
} }
// assign the roleId for the metadata doc
if (roleId) {
metadata.roleId = roleId
}
let combined = !deleting let combined = !deleting
? combineMetadataAndUser(user, metadata) ? combineMetadataAndUser(user, metadata)
: { : {