Merge pull request #24 from utopia-os/fix-the-fix

fix(other): final permission fix
This commit is contained in:
antontranelis 2024-11-01 08:22:34 +01:00 committed by GitHub
commit 39de17fa0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 14 deletions

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "utopia-ui",
"version": "3.0.5",
"version": "3.0.10",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "utopia-ui",
"version": "3.0.5",
"version": "3.0.10",
"license": "MIT",
"dependencies": {
"@heroicons/react": "^2.0.17",

View File

@ -1,6 +1,6 @@
{
"name": "utopia-ui",
"version": "3.0.5",
"version": "3.0.10",
"description": "Reuseable React Components to build mapping apps for real life communities and networks",
"repository": "https://github.com/utopia-os/utopia-ui",
"homepage:": "https://utopia-os.org/",

View File

@ -75,15 +75,6 @@ function usePermissionsManager(initialPermissions: Permission[]): {
layer?: LayerProps
) => {
console.log(layer?.name);
console.log(user?.role.name);
console.log(action);
console.log(permissions.filter(p => p.policy.name === user?.role.name || (p.policy.name === "$t:public_label" && !user)));
const evaluateCondition = (condition: any) => {
if (condition.user_created?._eq === "$CURRENT_USER") {
return item?.user_created?.id === user?.id;
@ -115,11 +106,11 @@ function usePermissionsManager(initialPermissions: Permission[]): {
p.collection === collectionName &&
(
(p.policy.name === user?.role.name &&
(p.policy?.name === user?.role.name &&
(
!item || evaluatePermissions(p.permissions)
)) ||
(p.policy === "$t:public_label" &&
(p.policy?.name === "$t:public_label" &&
(
(layer?.public_edit_items || item?.layer?.public_edit_items) &&
(!item || evaluatePermissions(p.permissions))