utopia-ui 3.0.8 → 3.0.9

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
@@ -3064,7 +3064,7 @@ function usePermissionsManager(initialPermissions) {
3064
3064
  console.log(layer === null || layer === void 0 ? void 0 : layer.name);
3065
3065
  console.log(user === null || user === void 0 ? void 0 : user.role.name);
3066
3066
  console.log(action);
3067
- console.log(permissions.filter(function (p) { return p.policy.name === (user === null || user === void 0 ? void 0 : user.role.name) || (p.policy.name === "$t:public_label" && !user); }));
3067
+ console.log(permissions.filter(function (p) { var _a, _b, _c; return user ? (((_a = p.policy) === null || _a === void 0 ? void 0 : _a.name) === ((_b = user === null || user === void 0 ? void 0 : user.role) === null || _b === void 0 ? void 0 : _b.name)) : (((_c = p.policy) === null || _c === void 0 ? void 0 : _c.name) === "$t:public_label" && !user); }));
3068
3068
  var evaluateCondition = function (condition) {
3069
3069
  var _a, _b, _c;
3070
3070
  if (((_a = condition.user_created) === null || _a === void 0 ? void 0 : _a._eq) === "$CURRENT_USER") {
@@ -3094,13 +3094,13 @@ function usePermissionsManager(initialPermissions) {
3094
3094
  return true;
3095
3095
  else {
3096
3096
  return permissions.some(function (p) {
3097
- var _a;
3097
+ var _a, _b, _c;
3098
3098
  return p.action === action &&
3099
3099
  p.collection === collectionName &&
3100
- ((p.policy.name === (user === null || user === void 0 ? void 0 : user.role.name) &&
3100
+ ((((_a = p.policy) === null || _a === void 0 ? void 0 : _a.name) === (user === null || user === void 0 ? void 0 : user.role.name) &&
3101
3101
  (!item || evaluatePermissions(p.permissions))) ||
3102
- (p.policy.name === "$t:public_label" &&
3103
- (((layer === null || layer === void 0 ? void 0 : layer.public_edit_items) || ((_a = item === null || item === void 0 ? void 0 : item.layer) === null || _a === void 0 ? void 0 : _a.public_edit_items)) &&
3102
+ (((_b = p.policy) === null || _b === void 0 ? void 0 : _b.name) === "$t:public_label" &&
3103
+ (((layer === null || layer === void 0 ? void 0 : layer.public_edit_items) || ((_c = item === null || item === void 0 ? void 0 : item.layer) === null || _c === void 0 ? void 0 : _c.public_edit_items)) &&
3104
3104
  (!item || evaluatePermissions(p.permissions)))));
3105
3105
  });
3106
3106
  }