@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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@7365admin1/core",
3
3
  "license": "MIT",
4
- "version": "3.110.0",
4
+ "version": "3.111.0",
5
5
  "author": "7365admin1",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.mjs",
@@ -98,6 +98,30 @@ describe("Assign Role works without a stored owner role, and stays scoped", { co
98
98
  assert.equal(row.roleName, "Security");
99
99
  assert.equal(row.roleState, "deleted");
100
100
  });
101
+
102
+ it("9. the Members list flags another site's role as other-site (with that site's name); an org-wide role stays ok", async () => {
103
+ // The page is cached per query, and these writes bypass the service, so
104
+ // each read asks a distinct page size to get a fresh aggregation.
105
+ let limit = 20;
106
+ const list = async () => {
107
+ const res = await h.api(`/members?org=${id.org}&siteId=${id.site}&type=security_agency&status=active&page=1&limit=${++limit}`, { sid: sid.OWNER });
108
+ assert.equal(res.status, 200, JSON.stringify(res.body));
109
+ return res.body.items.find((m) => String(m._id) === String(id.target));
110
+ };
111
+ await h.db.collection("members").updateOne({ _id: id.target }, { $set: { role: id.otherSiteRole } });
112
+ const other = await list();
113
+ assert.equal(other.roleName, "Security Roles");
114
+ assert.equal(other.roleState, "other-site");
115
+ assert.equal(other.roleSiteName, "The Loft");
116
+
117
+ await h.db.collection("members").updateOne({ _id: id.target }, { $set: { role: id.siteRole } });
118
+ assert.equal((await list()).roleState, "ok"); // this site's own role
119
+
120
+ await h.db.collection("members").updateOne({ _id: id.target }, { $set: { role: id.oldRole } });
121
+ const orgWide = await list();
122
+ assert.equal(orgWide.roleState, "ok"); // org-level role, no site
123
+ assert.equal(orgWide.roleSiteName, undefined);
124
+ });
101
125
  });
102
126
 
103
127
  async function seed(h) {