utopia-ui 3.0.4 → 3.0.6
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.
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Item, Tag } from '../../../types';
|
2
|
-
export declare const TabsView: ({ attestations, userType, item, offers, needs, relations, updatePermission, loading, linkItem, unlinkItem
|
2
|
+
export declare const TabsView: ({ attestations, userType, item, offers, needs, relations, updatePermission, loading, linkItem, unlinkItem }: {
|
3
3
|
attestations: Array<any>;
|
4
4
|
userType: string;
|
5
5
|
item: Item;
|
@@ -10,5 +10,4 @@ export declare const TabsView: ({ attestations, userType, item, offers, needs, r
|
|
10
10
|
loading: boolean;
|
11
11
|
linkItem: (id: string) => Promise<void>;
|
12
12
|
unlinkItem: (id: string) => Promise<void>;
|
13
|
-
setUrlParams: any;
|
14
13
|
}) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.js
CHANGED
@@ -3061,6 +3061,10 @@ function usePermissionsManager(initialPermissions) {
|
|
3061
3061
|
});
|
3062
3062
|
}, []);
|
3063
3063
|
var hasUserPermission = useCallback(function (collectionName, action, item, layer) {
|
3064
|
+
console.log(layer === null || layer === void 0 ? void 0 : layer.name);
|
3065
|
+
console.log(user === null || user === void 0 ? void 0 : user.role.name);
|
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); }));
|
3064
3068
|
var evaluateCondition = function (condition) {
|
3065
3069
|
var _a, _b, _c;
|
3066
3070
|
if (((_a = condition.user_created) === null || _a === void 0 ? void 0 : _a._eq) === "$CURRENT_USER") {
|
@@ -3081,8 +3085,10 @@ function usePermissionsManager(initialPermissions) {
|
|
3081
3085
|
: evaluateCondition(andCondition);
|
3082
3086
|
});
|
3083
3087
|
};
|
3088
|
+
if (collectionName === "items" && action === "create" && (layer === null || layer === void 0 ? void 0 : layer.public_edit_items))
|
3089
|
+
return true;
|
3084
3090
|
// Bedingung für leere Berechtigungen nur, wenn NICHT item und create
|
3085
|
-
if (permissions.length === 0
|
3091
|
+
if (permissions.length === 0)
|
3086
3092
|
return true;
|
3087
3093
|
else if (user && user.role.id === adminRole)
|
3088
3094
|
return true;
|
@@ -3091,17 +3097,14 @@ function usePermissionsManager(initialPermissions) {
|
|
3091
3097
|
var _a;
|
3092
3098
|
return p.action === action &&
|
3093
3099
|
p.collection === collectionName &&
|
3094
|
-
(
|
3095
|
-
|
3096
|
-
|
3097
|
-
|
3098
|
-
|
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))))));
|
3100
|
+
((p.policy.name === (user === null || user === void 0 ? void 0 : user.role.name) &&
|
3101
|
+
(!item || evaluatePermissions(p.permissions))) ||
|
3102
|
+
(p.policy === "$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)) &&
|
3104
|
+
(!item || evaluatePermissions(p.permissions)))));
|
3102
3105
|
});
|
3103
3106
|
}
|
3104
|
-
}, [permissions, user]);
|
3107
|
+
}, [permissions, user, adminRole]);
|
3105
3108
|
return { permissions: permissions, setPermissionApi: setPermissionApi, setPermissionData: setPermissionData, setAdminRole: setAdminRole, hasUserPermission: hasUserPermission };
|
3106
3109
|
}
|
3107
3110
|
var PermissionsProvider = function (_a) {
|
@@ -4419,7 +4422,7 @@ function ActionButton(_a) {
|
|
4419
4422
|
// eslint-disable-next-line no-unused-vars
|
4420
4423
|
var TabsView = function (_a) {
|
4421
4424
|
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
4422
|
-
var attestations = _a.attestations, userType = _a.userType, item = _a.item, offers = _a.offers, needs = _a.needs, relations = _a.relations, updatePermission = _a.updatePermission, loading = _a.loading, linkItem = _a.linkItem, unlinkItem = _a.unlinkItem
|
4425
|
+
var attestations = _a.attestations, userType = _a.userType, item = _a.item, offers = _a.offers, needs = _a.needs, relations = _a.relations, updatePermission = _a.updatePermission, loading = _a.loading, linkItem = _a.linkItem, unlinkItem = _a.unlinkItem;
|
4423
4426
|
var addFilterTag = useAddFilterTag();
|
4424
4427
|
var _l = useState(), activeTab = _l[0], setActiveTab = _l[1];
|
4425
4428
|
var navigate = useNavigate();
|
@@ -4443,7 +4446,6 @@ var TabsView = function (_a) {
|
|
4443
4446
|
params.set("tab", "".concat(id));
|
4444
4447
|
var newUrl = location.pathname + "?" + params.toString();
|
4445
4448
|
window.history.pushState({}, '', newUrl);
|
4446
|
-
setUrlParams(params);
|
4447
4449
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
4448
4450
|
}, [location.pathname]);
|
4449
4451
|
useEffect(function () {
|
@@ -4897,12 +4899,11 @@ function ProfileView(_a) {
|
|
4897
4899
|
var _a;
|
4898
4900
|
setTemplate(((_a = item === null || item === void 0 ? void 0 : item.layer) === null || _a === void 0 ? void 0 : _a.itemType.template) || userType);
|
4899
4901
|
}, [userType, item]);
|
4900
|
-
var /* urlParams, */ setUrlParams = useState(new URLSearchParams(location.search))[0];
|
4901
4902
|
return (jsx(Fragment, { children: item &&
|
4902
4903
|
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" &&
|
4903
4904
|
jsx(OnepagerView, { item: item, userType: userType }), template == "simple" &&
|
4904
4905
|
jsx(SimpleView, { item: item }), template == "tabs" &&
|
4905
|
-
jsx(TabsView, { userType: userType, attestations: attestations,
|
4906
|
+
jsx(TabsView, { userType: userType, attestations: attestations, item: item, loading: loading, offers: offers, needs: needs, relations: relations, updatePermission: updatePermission, linkItem: function (id) { return linkItem(id, item, updateItem); }, unlinkItem: function (id) { return unlinkItem(id, item, updateItem); } })] }) }), item.id) }));
|
4906
4907
|
}
|
4907
4908
|
|
4908
4909
|
var ComboBoxInput = function (_a) {
|