utopia-ui 3.0.3 → 3.0.5

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
@@ -3081,20 +3081,24 @@ function usePermissionsManager(initialPermissions) {
3081
3081
  : evaluateCondition(andCondition);
3082
3082
  });
3083
3083
  };
3084
- if (permissions.length === 0)
3084
+ // Bedingung für leere Berechtigungen nur, wenn NICHT item und create
3085
+ if (permissions.length === 0 && !(collectionName === "item" && action === "create"))
3085
3086
  return true;
3086
- else if (user && user.role === adminRole)
3087
+ else if (user && user.role.id === adminRole)
3087
3088
  return true;
3088
3089
  else {
3089
3090
  return permissions.some(function (p) {
3090
3091
  var _a;
3091
3092
  return p.action === action &&
3092
3093
  p.collection === collectionName &&
3093
- ((p.policy === (user === null || user === void 0 ? void 0 : user.role) &&
3094
- (!item || evaluatePermissions(p.permissions))) ||
3095
- (p.policy == null &&
3096
- (((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)) &&
3097
- (!item || evaluatePermissions(p.permissions)))));
3094
+ (
3095
+ // Neue Bedingung für "item" und "create"
3096
+ (collectionName === "item" && action === "create" && (layer === null || layer === void 0 ? void 0 : layer.public_edit_items) === true) ||
3097
+ ((p.policy.name === (user === null || user === void 0 ? void 0 : user.role.name) &&
3098
+ (!item || evaluatePermissions(p.permissions))) ||
3099
+ (p.policy == null &&
3100
+ (((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)) &&
3101
+ (!item || evaluatePermissions(p.permissions))))));
3098
3102
  });
3099
3103
  }
3100
3104
  }, [permissions, user]);
@@ -4893,7 +4897,7 @@ function ProfileView(_a) {
4893
4897
  var _a;
4894
4898
  setTemplate(((_a = item === null || item === void 0 ? void 0 : item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || userType);
4895
4899
  }, [userType, item]);
4896
- var /* urlParams, */ setUrlParams = useState(new URLSearchParams(location.search))[0];
4900
+ var _l = useState(new URLSearchParams(location.search)); _l[0]; var setUrlParams = _l[1];
4897
4901
  return (jsx(Fragment, { children: item &&
4898
4902
  jsx(MapOverlayPage, __assign({ className: "!tw-p-0 tw-mx-4 tw-mt-4 tw-mb-4 md:tw-w-[calc(50%-32px)] tw-w-[calc(100%-32px)] tw-min-w-80 tw-max-w-3xl !tw-left-0 sm:!tw-left-auto tw-top-0 tw-bottom-0 tw-transition-opacity tw-duration-500 ".concat(!selectPosition ? 'tw-opacity-100 tw-pointer-events-auto' : 'tw-opacity-0 tw-pointer-events-none') }, { children: jsxs(Fragment, { children: [jsx("div", __assign({ className: "tw-px-6 tw-pt-6" }, { children: jsx(HeaderView, { api: (_b = item.layer) === null || _b === void 0 ? void 0 : _b.api, item: item, deleteCallback: function (e) { return handleDelete(e, item, setLoading, removeItem, map, navigate); }, editCallback: function () { return navigate("/edit-item/" + item.id); }, setPositionCallback: function () { map.closePopup(); setSelectPosition(item); navigate("/"); }, big: true, truncateSubname: false }) })), template == "onepager" &&
4899
4903
  jsx(OnepagerView, { item: item, userType: userType }), template == "simple" &&