@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @iservice365/core
2
2
 
3
+ ## 3.111.0
4
+
5
+ ### Minor Changes
6
+
7
+ - f1f595f: Member list rows flag a role pinned to a different site than the membership's: `roleState` "other-site", plus `roleSiteName` (the site the role belongs to). Org-wide roles (no site) stay "ok".
8
+
3
9
  ## 3.110.0
4
10
 
5
11
  ### Minor Changes
package/dist/index.js CHANGED
@@ -4661,7 +4661,8 @@ function useMemberRepo() {
4661
4661
  type,
4662
4662
  status,
4663
4663
  // 3: rows carry roleState (2026-09-25) — older cached pages lack it.
4664
- projectionVersion: 3
4664
+ // 4: roleState "other-site" + roleSiteName.
4665
+ projectionVersion: 4
4665
4666
  };
4666
4667
  if (org) {
4667
4668
  try {
@@ -4719,10 +4720,21 @@ function useMemberRepo() {
4719
4720
  localField: "role",
4720
4721
  foreignField: "_id",
4721
4722
  as: "roles",
4722
- pipeline: [{ $project: { name: 1, org: 1, status: 1 } }]
4723
+ pipeline: [{ $project: { name: 1, org: 1, site: 1, status: 1 } }]
4723
4724
  }
4724
4725
  },
4725
4726
  { $unwind: { path: "$roles", preserveNullAndEmptyArrays: true } },
4727
+ {
4728
+ // The site a site-pinned role belongs to, for the "belongs to
4729
+ // <site>" warning. An org-wide role stores site "" → no match.
4730
+ $lookup: {
4731
+ from: "sites",
4732
+ localField: "roles.site",
4733
+ foreignField: "_id",
4734
+ as: "roleSite",
4735
+ pipeline: [{ $project: { name: 1 } }]
4736
+ }
4737
+ },
4726
4738
  {
4727
4739
  $lookup: {
4728
4740
  from: "users",
@@ -4743,19 +4755,31 @@ function useMemberRepo() {
4743
4755
  // Whether roleName is a role this member can really use, so the
4744
4756
  // Members list never shows a bare name that grants nothing
4745
4757
  // (owner report 2026-09-25). "ok" | "template" (org-less shared
4746
- // role) | "deleted" | "other-org" | "missing" (no role, or an
4747
- // id that resolves to nothing).
4758
+ // role) | "deleted" | "other-org" | "other-site" (the org's role,
4759
+ // pinned to a different site than this membership's — an
4760
+ // org-wide role with no site stays "ok") | "missing" (no role,
4761
+ // or an id that resolves to nothing).
4748
4762
  roleState: {
4749
4763
  $switch: {
4750
4764
  branches: [
4751
4765
  { case: { $not: ["$roles._id"] }, then: "missing" },
4752
4766
  { case: { $ne: [{ $ifNull: ["$roles.status", "active"] }, "active"] }, then: "deleted" },
4753
4767
  { case: { $in: [{ $ifNull: ["$roles.org", ""] }, ["", null]] }, then: "template" },
4754
- { case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" }
4768
+ { case: { $ne: [{ $toString: "$roles.org" }, { $toString: "$org" }] }, then: "other-org" },
4769
+ {
4770
+ case: {
4771
+ $and: [
4772
+ { $not: [{ $in: [{ $ifNull: ["$roles.site", ""] }, ["", null]] }] },
4773
+ { $ne: [{ $toString: "$roles.site" }, { $toString: { $ifNull: ["$siteId", ""] } }] }
4774
+ ]
4775
+ },
4776
+ then: "other-site"
4777
+ }
4755
4778
  ],
4756
4779
  default: "ok"
4757
4780
  }
4758
4781
  },
4782
+ roleSiteName: { $first: "$roleSite.name" },
4759
4783
  org: 1,
4760
4784
  orgName: 1,
4761
4785
  status: 1,