some more pr comments

This commit is contained in:
Peter Clement 2022-07-25 18:57:10 +01:00
parent 269701f97d
commit 3f8a006626
3 changed files with 13 additions and 4 deletions

View File

@ -124,6 +124,10 @@ export function generateTemplateID(ownerId: any) {
return `${DocumentTypes.TEMPLATE}${SEPARATOR}${ownerId}${SEPARATOR}${newid()}`
}
export function generateAppUserID(prodAppId: string, userId: string) {
return `${prodAppId}${SEPARATOR}${userId}`
}
/**
* Gets parameters for retrieving templates. Owner ID must be specified, either global or a workspace level.
*/

View File

@ -1,6 +1,11 @@
const { ViewNames, getUsersByAppParams, getProdAppID } = require("./db/utils")
const {
ViewNames,
getUsersByAppParams,
getProdAppID,
generateAppUserID,
} = require("./db/utils")
const { queryGlobalView } = require("./db/views")
const { UNICODE_MAX, SEPARATOR } = require("./db/constants")
const { UNICODE_MAX } = require("./db/constants")
/**
* Given an email address this will use a view to search through
@ -38,7 +43,7 @@ exports.getGlobalUserByAppPage = (appId, user) => {
if (!user) {
return
}
return `${getProdAppID(appId)}${SEPARATOR}${user._id}`
return generateAppUserID(getProdAppID(appId), user._id)
}
/**

View File

@ -100,6 +100,7 @@ export const buildUser = async (
opts: SaveUserOpts = {
hashPassword: true,
requirePassword: true,
bulkCreate: false,
},
tenantId: string,
dbUser?: any
@ -297,7 +298,6 @@ export const bulkCreate = async (newUsersRequested: any[], groups: any) => {
delete user.password
await eventHelpers.handleSaveEvents(user, null)
await apps.syncUserInApps(user._id)
await addTenant(tenantId, user._id, user.email)
}
return usersToBulkSave