@7365admin1/core 3.110.0 → 3.111.0
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/CHANGELOG.md +6 -0
- package/dist/index.js +29 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +29 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/assign-role-owner.e2e.test.mjs +24 -0
package/dist/index.mjs
CHANGED
|
@@ -3649,7 +3649,8 @@ function useMemberRepo() {
|
|
|
3649
3649
|
type,
|
|
3650
3650
|
status,
|
|
3651
3651
|
// 3: rows carry roleState (2026-09-25) — older cached pages lack it.
|
|
3652
|
-
|
|
3652
|
+
// 4: roleState "other-site" + roleSiteName.
|
|
3653
|
+
projectionVersion: 4
|
|
3653
3654
|
};
|
|
3654
3655
|
if (org) {
|
|
3655
3656
|
try {
|
|
@@ -3707,10 +3708,21 @@ function useMemberRepo() {
|
|
|
3707
3708
|
localField: "role",
|
|
3708
3709
|
foreignField: "_id",
|
|
3709
3710
|
as: "roles",
|
|
3710
|
-
pipeline: [{ $project: { name: 1, org: 1, status: 1 } }]
|
|
3711
|
+
pipeline: [{ $project: { name: 1, org: 1, site: 1, status: 1 } }]
|
|
3711
3712
|
}
|
|
3712
3713
|
},
|
|
3713
3714
|
{ $unwind: { path: "$roles", preserveNullAndEmptyArrays: true } },
|
|
3715
|
+
{
|
|
3716
|
+
// The site a site-pinned role belongs to, for the "belongs to
|
|
3717
|
+
// <site>" warning. An org-wide role stores site "" → no match.
|
|
3718
|
+
$lookup: {
|
|
3719
|
+
from: "sites",
|
|
3720
|
+
localField: "roles.site",
|
|
3721
|
+
foreignField: "_id",
|
|
3722
|
+
as: "roleSite",
|
|
3723
|
+
pipeline: [{ $project: { name: 1 } }]
|
|
3724
|
+
}
|
|
3725
|
+
},
|
|
3714
3726
|
{
|
|
3715
3727
|
$lookup: {
|
|
3716
3728
|
from: "users",
|
|
@@ -3731,19 +3743,31 @@ function useMemberRepo() {
|
|
|
3731
3743
|
// Whether roleName is a role this member can really use, so the
|
|
3732
3744
|
// Members list never shows a bare name that grants nothing
|
|
3733
3745
|
// (owner report 2026-09-25). "ok" | "template" (org-less shared
|
|
3734
|
-
// role) | "deleted" | "other-org" | "
|
|
3735
|
-
//
|
|
3746
|
+
// role) | "deleted" | "other-org" | "other-site" (the org's role,
|
|
3747
|
+
// pinned to a different site than this membership's — an
|
|
3748
|
+
// org-wide role with no site stays "ok") | "missing" (no role,
|
|
3749
|
+
// or an id that resolves to nothing).
|
|
3736
3750
|
roleState: {
|
|
3737
3751
|
$switch: {
|
|
3738
3752
|
branches: [
|
|
3739
3753
|
{ case: { $not: ["$roles._id"] }, then: "missing" },
|
|
3740
3754
|
{ case: { $ne: [{ $ifNull: ["$roles.status", "active"] }, "active"] }, then: "deleted" },
|
|
3741
3755
|
{ case: { $in: [{ $ifNull: ["$roles.org", ""] }, ["", null]] }, then: "template" },
|
|
3742
|
-
{ case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" }
|
|
3756
|
+
{ case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" },
|
|
3757
|
+
{
|
|
3758
|
+
case: {
|
|
3759
|
+
$and: [
|
|
3760
|
+
{ $not: [{ $in: [{ $ifNull: ["$roles.site", ""] }, ["", null]] }] },
|
|
3761
|
+
{ $ne: [{ $toString: "$roles.site" }, { $toString: { $ifNull: ["$siteId", ""] } }] }
|
|
3762
|
+
]
|
|
3763
|
+
},
|
|
3764
|
+
then: "other-site"
|
|
3765
|
+
}
|
|
3743
3766
|
],
|
|
3744
3767
|
default: "ok"
|
|
3745
3768
|
}
|
|
3746
3769
|
},
|
|
3770
|
+
roleSiteName: { $first: "$roleSite.name" },
|
|
3747
3771
|
org: 1,
|
|
3748
3772
|
orgName: 1,
|
|
3749
3773
|
status: 1,
|