shokri-navid / OCM-1.1

0 stars 0 forks source link

Adding "Send Invitation" action to the search sharees control #1

Open shokri-navid opened 2 hours ago

shokri-navid commented 2 hours ago

inside the sender panel when the user types an email in the search box like below:

image we must add another option below the email share link to enable user to sent invitation link to the recipient.

shokri-navid commented 2 hours ago

I found that the API call for searching sharees is:

/ocs/v2.php/apps/files_sharing/api/v1/sharees

and the code is:

https://github.com/SUNET/nextcloud-server/blob/aec5edc05bf855e3e112b01f1335e70a89d1f841/apps/files_sharing/lib/Controller/ShareesAPIController.php#L104

shokri-navid commented 1 hour ago

So, It seems We should add another Share Type in IShare file:

https://github.com/SUNET/nextcloud-server/blob/aec5edc05bf855e3e112b01f1335e70a89d1f841/lib/public/Share/IShare.php#L102

So I decided to add this type there:

public const TYPE_INVITATION_LINK = 16;

shokri-navid commented 1 hour ago

in calling the API this flow is executed:

1- https://github.com/SUNET/nextcloud-server/blob/aec5edc05bf855e3e112b01f1335e70a89d1f841/apps/files_sharing/lib/Controller/ShareesAPIController.php#L104

2- https://github.com/SUNET/nextcloud-server/blob/aec5edc05bf855e3e112b01f1335e70a89d1f841/lib/private/Share20/Manager.php#L1863

3- https://github.com/SUNET/nextcloud-server/blob/aec5edc05bf855e3e112b01f1335e70a89d1f841/lib/private/Share20/ProviderFactory.php#L309

we should decide whether need to register a new ShareProvider class or create a new one that is inherited from ShareByMailProvider class?

shokri-navid commented 1 hour ago

So it seems we should create our own share provider like ShareByEmailInvitationProvider. I looked into ShareByMailProvider there: https://github.com/SUNET/nextcloud-server/blob/master/apps/sharebymail/lib/ShareByMailProvider.php

and it has a specific template engine and data access layer inside the class code.

:eyes: I guess we should create our own application like shareByInvitationCode to put our db migrations and required helper classes there