Skip to content

Conversation

@MorrisJobke
Copy link
Member

@mention-bot
Copy link

@MorrisJobke, thanks for your PR! By analyzing the history of the files in this pull request, we identified @rullzer, @nickvergessen and @schiessle to be potential reviewers.

* Skip null groups in group manager (#26871)

* Skip null groups in group manager

* Also skip null groups in group manager's search function

* Add more group null checks in sharing code

* Add unit tests for null group safety in group manager

* Add unit tests for sharing code null group checks

* Added tests for null groups handling in sharing code

* Ignore moveShare optional repair in mount provider

In some cases, data is inconsistent in the oc_share table due to legacy
data. The mount provider might attempt to make it consistent but if the
target group does not exist any more it cannot work. In such case we
simply ignore the exception as it is not critical. Keeping the
exception would break user accounts as they would be unable to use
their filesystem.

* Adjust null group handing + tests

* Fix new group manager tests

Signed-off-by: Morris Jobke <[email protected]>

if ($checkGroups && $share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) {
$sharedWith = $this->groupManager->get($share->getSharedWith());
$user = $this->userManager->get($this->currentUser);
Copy link
Member

Choose a reason for hiding this comment

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

We could also save this call for $sharedWith === null
But since this is only for an error case it's probably okay

Signed-off-by: Joas Schilling <[email protected]>
Signed-off-by: Joas Schilling <[email protected]>
Copy link
Member

@nickvergessen nickvergessen left a comment

Choose a reason for hiding this comment

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

Added DI and fixed some code styling in the test

@icewind1991
Copy link
Member

Breaks with php5.6:

PHP Fatal error: Cannot use Test\Util\Group\Dummy as Dummy because the name is already in use in /drone/src/github.com/nextcloud/server/tests/lib/Group/ManagerTest.php on line 32

Signed-off-by: Joas Schilling <[email protected]>
@MorrisJobke
Copy link
Member Author

@karlitschek A backport to 11 of this is needed for #5636 - opened in #5636

@karlitschek
Copy link
Member

please backport 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants