utopia-ui 3.0.8 → 3.0.10
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 +4 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -3061,10 +3061,6 @@ 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); }));
|
3068
3064
|
var evaluateCondition = function (condition) {
|
3069
3065
|
var _a, _b, _c;
|
3070
3066
|
if (((_a = condition.user_created) === null || _a === void 0 ? void 0 : _a._eq) === "$CURRENT_USER") {
|
@@ -3094,13 +3090,13 @@ function usePermissionsManager(initialPermissions) {
|
|
3094
3090
|
return true;
|
3095
3091
|
else {
|
3096
3092
|
return permissions.some(function (p) {
|
3097
|
-
var _a;
|
3093
|
+
var _a, _b, _c;
|
3098
3094
|
return p.action === action &&
|
3099
3095
|
p.collection === collectionName &&
|
3100
|
-
((p.policy.name === (user === null || user === void 0 ? void 0 : user.role.name) &&
|
3096
|
+
((((_a = p.policy) === null || _a === void 0 ? void 0 : _a.name) === (user === null || user === void 0 ? void 0 : user.role.name) &&
|
3101
3097
|
(!item || evaluatePermissions(p.permissions))) ||
|
3102
|
-
(p.policy.name === "$t:public_label" &&
|
3103
|
-
(((layer === null || layer === void 0 ? void 0 : layer.public_edit_items) || ((
|
3098
|
+
(((_b = p.policy) === null || _b === void 0 ? void 0 : _b.name) === "$t:public_label" &&
|
3099
|
+
(((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
3100
|
(!item || evaluatePermissions(p.permissions)))));
|
3105
3101
|
});
|
3106
3102
|
}
|