@i4e/invest4edu-access-core 0.42.0 → 0.42.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@i4e/invest4edu-access-core",
|
|
3
|
-
"version": "0.42.
|
|
3
|
+
"version": "0.42.1",
|
|
4
4
|
"description": "Shared access-control primitives for NeoFindesk: tenant keystone, role capabilities, reportee tree, entity/role vocabulary, mobile app identity, feature flags, and the unified access engine (registry schema, snapshot resolver, visibleWhen).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -128,7 +128,10 @@ export function createClientProfileService({ getDb, getSettings, getSideContext
|
|
|
128
128
|
async function roleNamesOf(userId, session) {
|
|
129
129
|
const maps = await db().collection("userentitymappings").find({ user_id: userId, status: { $ne: 0 }, role_id: { $ne: null } }, { session, projection: { role_id: 1 } }).toArray();
|
|
130
130
|
if (!maps.length) return [];
|
|
131
|
-
|
|
131
|
+
// role_id is an ARRAY on real mappings; `$in` must get the role ids themselves, not the arrays
|
|
132
|
+
// (an array inside `$in` only matches an equal array, so every caller read as role-less).
|
|
133
|
+
const roleIds = maps.flatMap((m) => (Array.isArray(m.role_id) ? m.role_id : [m.role_id])).filter(Boolean);
|
|
134
|
+
const roles = await db().collection("roles").find({ _id: { $in: roleIds } }, { session, projection: { role_name: 1 } }).toArray();
|
|
132
135
|
return roles.map((r) => r.role_name).filter(Boolean);
|
|
133
136
|
}
|
|
134
137
|
|