fix: align space action permissions with backend abilities#2475
fix: align space action permissions with backend abilities#2475tiran133 wants to merge 2 commits intoopencloud-eu:mainfrom
Conversation
I'm not 100% sure, but if I remember correctly (and according to the docs) it shouldn't be. Disabling, restoring & deleting spaces is for administrators and space admins, not space managers. In that case this would be an API issue, since it currently allows all these operations for managers on their assigned spaces. There is no such thing as an "owner" of a project space, I believe that's why we went with that decision. I might be wrong though... @tbsbdr @micbar do you remember? Anyway, you stated that this PR is not tackling this issue, so to be honest, I'm having a hard time understanding what it actually solves for you. Is it related to the custom role you mentioned in opencloud-eu/opencloud#1799? |
Yes I agree. I'll check in with the team to get an answer to that, then we can decide how to move forward with this. Sorry for the long wait! |

Description
Space actions (
canBeDeleted,canRename,canEditDescription,canRestore)now honour the abilities reported by the backend when user has "create-all" permission.
According to
https://github.com/opencloud-eu/reva/blob/main/pkg/storage/utils/decomposedfs/spaces.go#L1115-L1116
The User should be able to disable/restore and delete its managed spaces.
Backend Permission for
create-allfrontend permission.Although it won't fix the underlaying issue that the owner of a space (User role) should be able to disable/delete/restore via the frontend. Currently, only disable is possible. Restoring or deleting a space as manager of that space with the User role is still not possible.
The comment in the functions.ts suggest problem with the permission model
https://github.com/opencloud-eu/web/blob/main/packages/web-client/src/helpers/space/functions.ts#L244
At least this honour
Drives.CreatewithCONSTRAINT_ALLRelated Issue
Disabling and deleting Spaces with API when UI for disabling and deleting space is not shown in context menu opencloud#1799
How Has This Been Tested?
pnpm viteagainst a local OpenCloud backend viadocker-compose up -d)packages/web-client/tests/unit/helpers/space/functions.spec.tsupdated/added to assert action-specific permission handling forcanBeDeleted,canRename,canEditDescription, andcanRestore(verified withpnpm test:unit --run packages/web-client/tests/unit/helpers/space/functions.spec.ts)pnpm check:allpasses (types, lint, format, unit tests)Types of changes