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

Alternative SMB external storage implementation where all users of on… #38151

Merged
merged 1 commit into from Dec 9, 2020

Conversation

DeepDiver1975
Copy link
Member

@DeepDiver1975 DeepDiver1975 commented Nov 27, 2020

…e share use the same storage id. User specific access is filtered in a cache wrapper by stating the files on SMB

Description

  • all users share the same storage id for the smb share (loggin via user credentials)
  • fileids are constant over users
  • fileid based concepts work (tagging, comments, direct link, file locking, wopi)

How Has This Been Tested?

Screenshots (if appropriate):

Setup of SMB version 2

Screenshot from 2020-11-30 09-54-55

Same file id is used and as result comments and tags are show properly on both users:

Screenshot from 2020-11-24 12-12-41

File ID is the same - see last query parameter in url

Screenshot from 2020-11-24 12-10-00

Tow users with different permissions see folder content accordingly:

Screenshot from 2020-11-24 12-08-56

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

@update-docs
Copy link

update-docs bot commented Nov 27, 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.

@DeepDiver1975 DeepDiver1975 force-pushed the feature/shared-cache-for-external-storages-2 branch from 57248b0 to 52c8f00 Compare November 27, 2020 14:23
@DeepDiver1975 DeepDiver1975 force-pushed the feature/shared-cache-for-external-storages-2 branch from 77d937f to 0ff8c57 Compare November 30, 2020 08:53
@DeepDiver1975 DeepDiver1975 marked this pull request as ready for review November 30, 2020 11:25
@@ -117,7 +117,8 @@ public function jsonSerialize() {
public function validateStorage(IStorageConfig $storage) {
// does the backend actually support this scheme
$supportedSchemes = $storage->getBackend()->getAuthSchemes();
if (!isset($supportedSchemes[$this->getScheme()])) {
if (!isset($supportedSchemes[$this->getScheme()]) &&
!isset($supportedSchemes[$this->getIdentifier()])) {
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this is a good idea. Having an auth mechanism id instead of a scheme id will be confusing.
It might be better to keep using the scheme and allow username+password even though it doesn't make sense for this scenario. Note that WND will add new auth mechanism that might be usable in this context too.

Copy link
Member Author

Choose a reason for hiding this comment

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

I honestly want to limit this storage to sessioncredentials (and in wnd whatever will work there) anything else will just result in bullshit.
But yes - i am not too happy with this either - maybe we better introduce an explicit array of auth identifiers in addition ....

$this
->setIdentifier('smb2')
->setStorageClass('\OCA\Files_External\Lib\Storage\SMB2')
->setText($l->t('SMB / CIFS (version 2)'))
Copy link
Member

Choose a reason for hiding this comment

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

This might need some rewording:

  • Is it for SMB2 protocol? Can I use this with a SMB1 connection?
  • Does this new code deprecated the previous SMB mounts? (version 2 suggests improvements over the old SMB connection code)

As far as I know, previous SMB code is still valid and might perform better in some scenarios, so it seems this implementation can live side by side with the old one.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes - this is where product management is called to do some naming bingo ;-)

The 'old' implementation is still valid to be used ... no need fro deprication

@jvillafanez
Copy link
Member

Note sure if we need to include a cache for the stat calls. Other than the code, the code looks fine

@DeepDiver1975
Copy link
Member Author

Note sure if we need to include a cache for the stat calls.

We will find out in some real life testing ....

@hodyroff
Copy link
Contributor

hodyroff commented Dec 1, 2020

I would name this: "shared file ID" in German: "file ID Mehrfachnutzung" maybe @pmaier has a better idea ...

@pmaier1
Copy link
Contributor

pmaier1 commented Dec 3, 2020

Regarding wording, I actually like @DeepDiver1975's suggestion in another channel:

  • SMB Personal (unique file IDs)
  • SMB Collaborative (shared file IDs)

@DeepDiver1975 DeepDiver1975 marked this pull request as draft December 3, 2020 11:57
@DeepDiver1975
Copy link
Member Author

converting back to draft because of detected side effects while testing ....

@DeepDiver1975 DeepDiver1975 force-pushed the feature/shared-cache-for-external-storages-2 branch 2 times, most recently from 8fc1dea to d974ec0 Compare December 7, 2020 15:17
@DeepDiver1975 DeepDiver1975 marked this pull request as ready for review December 8, 2020 07:42
@DeepDiver1975 DeepDiver1975 force-pushed the feature/shared-cache-for-external-storages-2 branch from d974ec0 to a8c13fd Compare December 9, 2020 08:15
…e share use the same storage id. User specific access is filtered in a cache wrapper by stating the files on SMB

Only password::sessioncredentials is allowed for authentication and SMBv2 can only be setup by admins
@DeepDiver1975 DeepDiver1975 force-pushed the feature/shared-cache-for-external-storages-2 branch from a8c13fd to 941d393 Compare December 9, 2020 08:21
@sonarcloud
Copy link

sonarcloud bot commented Dec 9, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

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

@DeepDiver1975 DeepDiver1975 merged commit 0153fc7 into master Dec 9, 2020
@delete-merged-branch delete-merged-branch bot deleted the feature/shared-cache-for-external-storages-2 branch December 9, 2020 10:25
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.

None yet

4 participants