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

Get access list share by email recipients #32631

Merged

Conversation

ASerbinski
Copy link
Contributor

@ASerbinski ASerbinski commented May 27, 2022

Close #32629

Summary:

Return the recipients for an email share.

We already have mail, but it's unused / broken.

The backstory:

In #2834 mail => bool was documented but not implemented.

image

Commit to change mail to public: cab4111

@ASerbinski ASerbinski linked an issue May 27, 2022 that may be closed by this pull request
@ASerbinski ASerbinski linked an issue May 27, 2022 that may be closed by this pull request
8 tasks
apps/sharebymail/lib/ShareByMailProvider.php Outdated Show resolved Hide resolved
*
* The access list to '/folder1/folder2/fileA' **without** $currentAccess is:
* [
* users => ['user1', 'user2', 'user4'],
* remote => bool,
* public => bool
* mail => bool
* mail => ['email1@maildomain1', 'email2@maildomain2']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is an api break :( not sure if we can change this, but if it never worked it's probably fine

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it certainly is an API break. I went through the history and it never actually used the correct array key.

lib/private/Share20/Manager.php Outdated Show resolved Hide resolved
@tcitworld tcitworld removed their request for review June 5, 2022 15:15
@AndyScherzinger AndyScherzinger removed their request for review June 6, 2022 18:34
@szaimen szaimen added enhancement 3. to review Waiting for reviews labels Jun 9, 2022
@szaimen szaimen added this to the Nextcloud 25 milestone Jun 9, 2022
This was referenced Aug 12, 2022
This was referenced Aug 24, 2022
This was referenced Sep 6, 2022
@skjnldsv skjnldsv mentioned this pull request Sep 15, 2022
This was referenced Sep 20, 2022
@blizzz blizzz modified the milestones: Nextcloud 25, Nextcloud 26 Sep 22, 2022
@kesselb
Copy link
Contributor

kesselb commented Jan 23, 2023

Hi @ASerbinski

Thanks for your pull request 👍

Sorry for not getting back to you sooner.
Would you mind rebasing your branch to pull the latest changes?

@kesselb
Copy link
Contributor

kesselb commented Jan 23, 2023

Would you mind splitting the bug fix and enhancement into own pull requests?

As Carl mentioned, the enhancement comes with an API break.
That's harder to review and accept than a bug report.

@ASerbinski ASerbinski force-pushed the feature/32629/getAccessList-share-by-email-recipients branch 2 times, most recently from a9c0f18 to 3191654 Compare January 23, 2023 15:36
@ASerbinski
Copy link
Contributor Author

Hi @kesselb ;

As you've requested, I've rebased on master and split the bug fix into #36305

This PR now depends on that bug fix.

@AndyScherzinger AndyScherzinger force-pushed the feature/32629/getAccessList-share-by-email-recipients branch from e6f987d to 53bfa7c Compare February 27, 2024 13:07
@Altahrim Altahrim mentioned this pull request Mar 12, 2024
@ChristophWurst ChristophWurst added the pending documentation This pull request needs an associated documentation update label Mar 13, 2024
This was referenced Mar 14, 2024
@ASerbinski ASerbinski force-pushed the feature/32629/getAccessList-share-by-email-recipients branch from 53bfa7c to dfe8e45 Compare March 20, 2024 15:31
@AndyScherzinger AndyScherzinger requested review from sorbaugh and removed request for PVince81 and CarlSchwan March 20, 2024 19:44
@blizzz
Copy link
Member

blizzz commented Mar 20, 2024

Failing test seem related, for example:

There was 1 failure:

1) OCA\ShareByMail\Tests\ShareByMailProviderTest::testGetAccessList
Failed asserting that true is false.

/home/runner/actions-runner/_work/server/server/apps/sharebymail/tests/ShareByMailProviderTest.php:1093

@AndyScherzinger
Copy link
Member

@ASerbinski see comment from blizzz #32631 (comment)

@ASerbinski ASerbinski force-pushed the feature/32629/getAccessList-share-by-email-recipients branch from 37d9142 to 1c92874 Compare March 21, 2024 20:01
@ASerbinski
Copy link
Contributor Author

@AndyScherzinger @blizzz ;

Added a commit based on php documentation; https://www.php.net/manual/en/pdostatement.rowcount.php

"For statements that produce result sets, such as SELECT, the behavior is undefined"

Passing applicable unit test;

$ ./autotest.sh sqlite apps/sharebymail/tests/ShareByMailProviderTest.php
...
Time: 00:01.135, Memory: 36.00 MB

OK (37 tests, 186 assertions)

Other failures are unrelated and seem to refer to some kind of network failure.

Previously was returning only boolean true if the Node was shared
by email, or false if not. Now provides an array containing the
list of email share recipients.

Signed-off-by: Adam Serbinski <[email protected]>
This allows the share URI to be regenerated.

Signed-off-by: Adam Serbinski <[email protected]>
…'mail'

To preserve prior behaviour where 'public' was set 'true' if there
are any mail recipients. The 'mail' key will be an array of email
recipients.

Signed-off-by: Adam Serbinski <[email protected]>
PDOStatement::rowCount behavior is undefined for SELECT statements
for some database types, therefore manually set the value for 'public'
based on actual results fetched.

Signed-off-by: Adam Serbinski <[email protected]>
@ASerbinski ASerbinski force-pushed the feature/32629/getAccessList-share-by-email-recipients branch from 1c92874 to f45eb75 Compare March 21, 2024 22:25
@ASerbinski
Copy link
Contributor Author

@AndyScherzinger is it good now?

@AndyScherzinger
Copy link
Member

I am AFK but asked @sorbaugh to lend a hand in getting it merged

@Altahrim Altahrim mentioned this pull request Mar 25, 2024
@AndyScherzinger AndyScherzinger merged commit 46906b7 into master Mar 25, 2024
166 of 167 checks passed
@AndyScherzinger AndyScherzinger deleted the feature/32629/getAccessList-share-by-email-recipients branch March 25, 2024 11:40
Copy link

welcome bot commented Mar 25, 2024

Thanks for your first pull request and welcome to the community! Feel free to keep them coming! If you are looking for issues to tackle then have a look at this selection: https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22

@AndyScherzinger
Copy link
Member

@ASerbinski merged 👍 Fancy writing a piece for the documentation repo to make the command easy to discover for others? 🙏

Thanks for the work on implementing this feature and for yet another contribution 🎉💯🚀

@ASerbinski
Copy link
Contributor Author

Thank you very much!
I'll give the documentation a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement pending documentation This pull request needs an associated documentation update
Projects
None yet
8 participants