Skip to content
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

User cannot see the files that are shared with their group. #28

Closed
shokri-navid opened this issue Nov 25, 2022 · 19 comments
Closed

User cannot see the files that are shared with their group. #28

shokri-navid opened this issue Nov 25, 2022 · 19 comments

Comments

@shokri-navid
Copy link
Collaborator

I share a file from oc1.docker with a group on oc2.docker.
on oc1 file marked as shared with a group on oc2. docker and also a record had been inserted into oc_share_external table of maria2.docker.

but Marie cannot see the file inside her file browser in the shared with you category.

@shokri-navid
Copy link
Collaborator Author

it seems that the current share manager just retrieves the shared file according to the username. but we should add the group criteria to that method.

@shokri-navid
Copy link
Collaborator Author

The starting point is the Share20OcsController.php --> getShares function of the files_shareing app

@shokri-navid
Copy link
Collaborator Author

call hierarchy is :

1- Share20OcsController.php --> getShares()
2- Share20OcsController.php -->getSharedWithMe()
3- Share20 --> Manager --> getSharedWith()

@shokri-navid
Copy link
Collaborator Author

at this line:
https://github.com/pondersource/core/blob/353925dfd56f050ffe5fb5cc9f538760e629af1d/lib/private/Share20/Manager.php#L1360

$provider is instantiated from https://github.com/SURFnet/rd-sram-integration/blob/main/federatedgroups/lib/GroupShareProvider.php

and because it is inherited from DefaultShareProvider without overriding the getSharedWith method it is acting like the parent.

@michielbdejong michielbdejong changed the title I cannot see the files those are shared with my group. User cannot see the files that are shared with their group. Nov 28, 2022
@shokri-navid
Copy link
Collaborator Author

There is another API call
https://oc2.docker/ocs/v1.php/apps/files_sharing/api/v1/remote_shares/all?format=json&include_tags=true
that is called to get all federated shared files and it is a new thread that we should follow.

@shokri-navid
Copy link
Collaborator Author

shokri-navid commented Nov 30, 2022

I encountered with a important question. If we query shared file based on group name the first user who accept the shared file flag it as accepted for all the group members. so it is dictatorship approach :) that we are familiar with in Iran :(.
the acceptable solution is to add share file for all the users those are member of the given group. we also should listen to User Added to / Removed from Group events.

@shokri-navid
Copy link
Collaborator Author

next challenge is finding a way to distinguish between user id and group Id when we are accepting/rejecting shred file.

@michielbdejong
Copy link
Contributor

michielbdejong commented Nov 30, 2022

the first user who accept the shared file flag it as accepted for all the group members.

Yes, good point! In this case, we can follow the behaviour of local shares to (custom or regular) groups, namely, they are automatically accepted.
I think the user can then individually revoke a share but it does stay in the 'shared with you' list. We have to check the exact behaviour and copy it.

we also should listen to User Added to / Removed from Group events.

Yes, this is milestone 2

@shokri-navid
Copy link
Collaborator Author

So if the current behavior (auto accepting) is desired so there is no need to listen to any event anymore.

@shokri-navid
Copy link
Collaborator Author

so there are a lot of changes that we should perform on : Manager.php
to check the given user Id is really an user Id or it is group id actually

@shokri-navid
Copy link
Collaborator Author

shokri-navid commented Dec 2, 2022

the first user who accepts the shared file flag it as acceptable for all the group members.

the same problem is valid for deleting the shared file. if I cannot remove a group shared file independently without affecting other users.

@shokri-navid
Copy link
Collaborator Author

I did not find any function in the owncloud's sdk to add and accept share meanwhile. I should take a look at custom group code. but as it is understood it is just available for the SaaS and Enterprise version.

@michielbdejong
Copy link
Contributor

No, it's an app, we're already using it:
https://github.com/SURFnet/rd-sram-integration/blob/ba45efc/scripts/start-testnet.sh#L61
Do you see this group in your Codespace?

@shokri-navid
Copy link
Collaborator Author

shokri-navid commented Dec 2, 2022

So I checked the custom group behavior.
I found multiple point about it:

1- It does not work with FederatedGroup/ShareProviderFactory.php
2 - if we disable settings > sharing > Automatically accept new incoming local user shares workflow will add a row in oc_share for each user who disabled this option. and also a row for whole group.
3- If all users set the option enable we have just one row for group only.

what if all group set option true and one of them delete that file.

this comment will be updated

@michielbdejong
Copy link
Contributor

I think maybe in https://github.com/pondersource/core/blob/95792e6/apps/federatedfilesharing/lib/Controller/OcmController.php#L239 we need to check the group name with customgroup_ prefix? Let's debug! :)

@shokri-navid
Copy link
Collaborator Author

I changed the approach. every incoming federated group share will add an oc_file_external share entry for each group member user. so this resolves the problem and all functionalities are working correctly without any new changes in other places.

@michielbdejong
Copy link
Contributor

I changed the approach. every incoming federated group share will add an oc_file_external share entry for each group member user.

Hm, but that's different from how it works for local group shares, as you described in #28 (comment)

so this resolves the problem

What is "the problem"? Are you referring to your earlier question?

what if all group set option true and one of them delete that file.
this comment will be updated

I don't know if it's possible to delete a file that was shared with you. Let's try it!
Also, is it possible to revoke a share if it came to you as a local group share?

Can we make external group shares work the same way as local group shares?
Maybe this is a question to discuss with Juan.

@michielbdejong
Copy link
Contributor

Progress:

@michielbdejong
Copy link
Contributor

Leaving this issue closed as a duplicate of #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants