diff --git a/packages/server/src/api/controllers/user.js b/packages/server/src/api/controllers/user.js index 4461cbfe24..6dfaf9847d 100644 --- a/packages/server/src/api/controllers/user.js +++ b/packages/server/src/api/controllers/user.js @@ -97,6 +97,7 @@ exports.syncUser = async function (ctx) { .map(([appId]) => appId) } for (let prodAppId of prodAppIds) { + const roleId = roles[prodAppId] const devAppId = getDevelopmentAppID(prodAppId) for (let appId of [prodAppId, devAppId]) { if (!(await doesDatabaseExist(appId))) { @@ -115,6 +116,10 @@ exports.syncUser = async function (ctx) { tableId: InternalTables.USER_METADATA, } } + // assign the roleId for the metadata doc + if (roleId) { + metadata.roleId = roleId + } let combined = !deleting ? combineMetadataAndUser(user, metadata) : {