feat: allow users to have access to multiple oorgs
This commit is contained in:
@@ -27,7 +27,7 @@ export async function createRts(
|
||||
let defaultClient = input.client;
|
||||
const userInDb = await getUserWithoutPopulate(user.userId);
|
||||
if (userInDb && userInDb.orgId) {
|
||||
defaultClient = userInDb.orgId.toString();
|
||||
defaultClient = userInDb.orgId[0].toString();
|
||||
}
|
||||
|
||||
if (!input.stage) {
|
||||
@@ -83,7 +83,11 @@ export async function listRts(
|
||||
let filterObj = getFilterObject(params) || [];
|
||||
|
||||
if (user.role === "client") {
|
||||
filterObj.push({ client: new mongoose.Types.ObjectId(user.orgId) });
|
||||
filterObj.push({
|
||||
client: {
|
||||
$in: user.orgId.map((item) => new mongoose.Types.ObjectId(item)),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
let { taggedFilter, taggedUserFilterIndex } = getTaggedUsersFilter(
|
||||
|
||||
Reference in New Issue
Block a user