mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
Merge pull request #24 from utopia-os/fix-the-fix
fix(other): final permission fix
This commit is contained in:
commit
39de17fa0f
4
package-lock.json
generated
4
package-lock.json
generated
@ -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",
|
||||
|
||||
@ -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/",
|
||||
|
||||
@ -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))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user