X Tutup
Skip to content

setupFS for share user before accepting a federated share#37834

Merged
phil-davis merged 1 commit intomasterfrom
setupfs-federation
Oct 9, 2020
Merged

setupFS for share user before accepting a federated share#37834
phil-davis merged 1 commit intomasterfrom
setupfs-federation

Conversation

@karakayasemi
Copy link
Contributor

@karakayasemi karakayasemi commented Aug 22, 2020

Description

Filesystem may not set already for shared user in some cases when accepting a federated share. This PR resolves this problem. Since setupFS function does not allows second initialization, this pr change will not affect performance.

Related Issue

Motivation and Context

Resolving bugs.

How Has This Been Tested?

Manually with the sconario describe in related issues.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@karakayasemi karakayasemi self-assigned this Aug 22, 2020
@update-docs
Copy link

update-docs bot commented Aug 22, 2020

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@karakayasemi karakayasemi marked this pull request as ready for review August 22, 2020 22:10
@karakayasemi karakayasemi added this to the development milestone Aug 22, 2020
@codecov
Copy link

codecov bot commented Aug 22, 2020

Codecov Report

Merging #37834 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master   #37834   +/-   ##
=========================================
  Coverage     64.75%   64.75%           
  Complexity    19392    19392           
=========================================
  Files          1284     1284           
  Lines         75755    75756    +1     
  Branches       1333     1333           
=========================================
+ Hits          49057    49058    +1     
  Misses        26306    26306           
  Partials        392      392           
Flag Coverage Δ Complexity Δ
#javascript 54.03% <ø> (ø) 0.00 <ø> (ø)
#phpunit 65.94% <100.00%> (+<0.01%) 19392.00 <0.00> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
apps/files_sharing/lib/External/Manager.php 90.11% <100.00%> (+0.05%) 33.00 <0.00> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9e4f61...db08a09. Read the comment docs.

@jvillafanez
Copy link
Member

Since setupFS function does not allows second initialization

That's a safety net that we have but we shouldn't use or abuse. If you call the setupFS function twice, you have a problem to solve. In fact, I think we should have a debug log (or even I warning) to detect this problem easily.

According to my investigation, the problem isn't that the setupFS isn't called but the app calls the FS too early. The FS isn't initialized yet when the 3rd-party app is being loaded.
I think we should check the app loading order. It makes more sense to me that core calls the setupFS after all the filesystem apps are loaded. In this case, the music app should be loaded after the filesystem apps (I don't see a reason why the music app should be tagged as filesystem app).
Obviously, the same problem could happen with apps that must be loaded before the FS (session, authentication... apps), but that's kind of expected.

@paulijar
Copy link
Contributor

@jvillafanez

I don't see a reason why the music app should be tagged as filesystem app

Do you mean this definition in the info.xml:

<types>
	<filesystem/>
</types>

?

If yes, then that's actually pretty important for any app which listens the filesystem hooks, and depends on them for correct functionality. If this tag is not given, the application is allowed to be "Enable only for specific groups" by the admin. When this is done, the application cannot react to the file system hooks from all users, and the music database may end up to inconsistent state, containing references to files which do not exist.

@cdamken
Copy link
Contributor

cdamken commented Sep 22, 2020

@karakayasemi @paulijar @jvillafanez @micbar Applying the patch works, I tested manually.

Which are the next steps?

@jvillafanez
Copy link
Member

I'm not fully happy with the solution, but I don't want to block this fix. If everyone agrees, I'm fine with merging the PR.

@VicDeo
Copy link
Member

VicDeo commented Oct 8, 2020

@karakayasemi please rebase

@sonarqubecloud
Copy link

sonarqubecloud bot commented Oct 8, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@phil-davis phil-davis merged commit dacaf15 into master Oct 9, 2020
@delete-merged-branch delete-merged-branch bot deleted the setupfs-federation branch October 9, 2020 02:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Calling getRootFolder() within any app.php prevents the accepting of federated shares Federated Shares can't accepted if music app is enabled

6 participants

X Tutup