-
Notifications
You must be signed in to change notification settings - Fork 4
[PB-2424] User can't details of an item shared by another member #445
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Currently, Sharings Guard and Workspaces Guard are tied together, as sharings are also managed within workspaces. To achieve your objective, you can:
You can accomplish what you need by adding the next line to the controller and creating a new migration that adds this permission to the permissions table. Note: This approach does not work for files/folders located in the root of the sharings section because these requests require a token (internxt-resources-token). However, this is a minor issue since the path is limited to shared/ in such cases. REGARDING THIS WORKING ON INDIVIDUALS WITHOUT ANY TOKEN: Requests to ancestors in individual sharings bypass permissions checks due to a bug in the query / request. You can confirm this behavior because parent folders are never returned in individual sharings, even if you are inside a children folder. |
|
Please @evillalba94 test the migration changes most similarly to the production database state, that means: with existent rows, otherwise we face this: |
The column There is a migration that was initially done by placing the |
| } | ||
|
|
||
| const extractData = this.getSharedDataFromRequest(request, context); | ||
| const isSharedWithMe = decoded.sharedWithUserUuid === requester.uuid; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can just skip this isSharedWithMe thing as the functions isWorkspaceMemberAbleToPerfomAction and isUserAbleToPerfomAction already check this, but it is ok, just make sure it does not break anything.
| } | ||
|
|
||
| if (!userIsAllowedToPerfomAction) { | ||
| return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just as note for the future, nestjs interpretes return false from guards as "forbidden exception". So you do not need to rewrite this kind of things
|
Dunno how that happened @evillalba94. This is the current situation in production, so you can adjust it (without doing any drop table, ofc)
The name is just a label, the type is where you want to do the modification. However, both fields hold the same values. Adjust it and ping me again once the migration is again ready to be run. |
…uction - check the column named type first
|
sg-gs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sequelize CLI [Node: 20.12.2, CLI: 6.6.2, ORM: 6.35.0]
Loaded configuration file "src/config/sequelize.js".
Using environment "production".
== 20250128142106-add-view-details-to-permissions: migrating =======
== 20250128142106-add-view-details-to-permissions: migrated (0.332s)
✨ Done in 3.41s.






READ
Ticket
Updates
ancestorsendpoint was created for Workspace.isSharedItemastrueto grant access user.@IsSharedItem()<==>request.isSharedItemWorkspaceItemUser.creatorasuserSharingActionName.ViewDetails.Important
VIEW_DETAILSin the permissions table and associate it with the corresponding roles