@7365admin1/core 3.99.1-staging.387 → 3.99.1-staging.388
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/dist/index.js
CHANGED
|
@@ -4679,7 +4679,8 @@ function useMemberRepo() {
|
|
|
4679
4679
|
type,
|
|
4680
4680
|
status,
|
|
4681
4681
|
// 3: rows carry roleState (2026-09-25) — older cached pages lack it.
|
|
4682
|
-
|
|
4682
|
+
// 4: roleState "other-site" + roleSiteName.
|
|
4683
|
+
projectionVersion: 4
|
|
4683
4684
|
};
|
|
4684
4685
|
if (org) {
|
|
4685
4686
|
try {
|
|
@@ -4737,10 +4738,21 @@ function useMemberRepo() {
|
|
|
4737
4738
|
localField: "role",
|
|
4738
4739
|
foreignField: "_id",
|
|
4739
4740
|
as: "roles",
|
|
4740
|
-
pipeline: [{ $project: { name: 1, org: 1, status: 1 } }]
|
|
4741
|
+
pipeline: [{ $project: { name: 1, org: 1, site: 1, status: 1 } }]
|
|
4741
4742
|
}
|
|
4742
4743
|
},
|
|
4743
4744
|
{ $unwind: { path: "$roles", preserveNullAndEmptyArrays: true } },
|
|
4745
|
+
{
|
|
4746
|
+
// The site a site-pinned role belongs to, for the "belongs to
|
|
4747
|
+
// <site>" warning. An org-wide role stores site "" → no match.
|
|
4748
|
+
$lookup: {
|
|
4749
|
+
from: "sites",
|
|
4750
|
+
localField: "roles.site",
|
|
4751
|
+
foreignField: "_id",
|
|
4752
|
+
as: "roleSite",
|
|
4753
|
+
pipeline: [{ $project: { name: 1 } }]
|
|
4754
|
+
}
|
|
4755
|
+
},
|
|
4744
4756
|
{
|
|
4745
4757
|
$lookup: {
|
|
4746
4758
|
from: "users",
|
|
@@ -4761,19 +4773,31 @@ function useMemberRepo() {
|
|
|
4761
4773
|
// Whether roleName is a role this member can really use, so the
|
|
4762
4774
|
// Members list never shows a bare name that grants nothing
|
|
4763
4775
|
// (owner report 2026-09-25). "ok" | "template" (org-less shared
|
|
4764
|
-
// role) | "deleted" | "other-org" | "
|
|
4765
|
-
//
|
|
4776
|
+
// role) | "deleted" | "other-org" | "other-site" (the org's role,
|
|
4777
|
+
// pinned to a different site than this membership's — an
|
|
4778
|
+
// org-wide role with no site stays "ok") | "missing" (no role,
|
|
4779
|
+
// or an id that resolves to nothing).
|
|
4766
4780
|
roleState: {
|
|
4767
4781
|
$switch: {
|
|
4768
4782
|
branches: [
|
|
4769
4783
|
{ case: { $not: ["$roles._id"] }, then: "missing" },
|
|
4770
4784
|
{ case: { $ne: [{ $ifNull: ["$roles.status", "active"] }, "active"] }, then: "deleted" },
|
|
4771
4785
|
{ case: { $in: [{ $ifNull: ["$roles.org", ""] }, ["", null]] }, then: "template" },
|
|
4772
|
-
{ case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" }
|
|
4786
|
+
{ case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" },
|
|
4787
|
+
{
|
|
4788
|
+
case: {
|
|
4789
|
+
$and: [
|
|
4790
|
+
{ $not: [{ $in: [{ $ifNull: ["$roles.site", ""] }, ["", null]] }] },
|
|
4791
|
+
{ $ne: [{ $toString: "$roles.site" }, { $toString: { $ifNull: ["$siteId", ""] } }] }
|
|
4792
|
+
]
|
|
4793
|
+
},
|
|
4794
|
+
then: "other-site"
|
|
4795
|
+
}
|
|
4773
4796
|
],
|
|
4774
4797
|
default: "ok"
|
|
4775
4798
|
}
|
|
4776
4799
|
},
|
|
4800
|
+
roleSiteName: { $first: "$roleSite.name" },
|
|
4777
4801
|
org: 1,
|
|
4778
4802
|
orgName: 1,
|
|
4779
4803
|
status: 1,
|