@liveblocks/core 3.21.0-private2 → 3.21.0-private3
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.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "3.21.0-
|
|
9
|
+
var PKG_VERSION = "3.21.0-private3";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5333,8 +5333,17 @@ function permissionMatrixFromScopes(scopes) {
|
|
|
5333
5333
|
);
|
|
5334
5334
|
}
|
|
5335
5335
|
function hasPermissionAccess(matrix, resource, requiredAccess) {
|
|
5336
|
+
const requiredRank = ACCESS_LEVEL_RANKS[requiredAccess];
|
|
5337
|
+
if (resource === "comments") {
|
|
5338
|
+
const commentsRank = Math.max(
|
|
5339
|
+
ACCESS_LEVEL_RANKS[matrix.comments ?? "none"],
|
|
5340
|
+
ACCESS_LEVEL_RANKS[matrix["comments:public"] ?? "none"],
|
|
5341
|
+
ACCESS_LEVEL_RANKS[matrix["comments:private"] ?? "none"]
|
|
5342
|
+
);
|
|
5343
|
+
return commentsRank >= requiredRank;
|
|
5344
|
+
}
|
|
5336
5345
|
const access = matrix[resource] ?? "none";
|
|
5337
|
-
return ACCESS_LEVEL_RANKS[access] >=
|
|
5346
|
+
return ACCESS_LEVEL_RANKS[access] >= requiredRank;
|
|
5338
5347
|
}
|
|
5339
5348
|
function resolveRoomPermissionMatrix(permissions, roomId) {
|
|
5340
5349
|
const matchedPermissions = permissions.filter(
|
|
@@ -5712,9 +5721,6 @@ function cachedTokenSatisfiesRequest(cachedToken, request) {
|
|
|
5712
5721
|
if (matrix === void 0) {
|
|
5713
5722
|
return false;
|
|
5714
5723
|
}
|
|
5715
|
-
if (request.resource === "comments" && request.access === "read") {
|
|
5716
|
-
return hasPermissionAccess(matrix, "comments", "read") || hasPermissionAccess(matrix, "comments:public", "read") || hasPermissionAccess(matrix, "comments:private", "read");
|
|
5717
|
-
}
|
|
5718
5724
|
return hasPermissionAccess(matrix, request.resource, request.access);
|
|
5719
5725
|
}
|
|
5720
5726
|
function prepareAuthentication(authOptions) {
|