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

Can share capability #31816

Merged
merged 2 commits into from
Jun 18, 2018
Merged

Can share capability #31816

merged 2 commits into from
Jun 18, 2018

Conversation

phil-davis
Copy link
Contributor

@phil-davis phil-davis commented Jun 18, 2018

Description

  1. Add a capability to the capabilities endpoint can_share
  2. Report true if the user is able to share files/folders (possibly restricted by the other general files_sharing settings).
  3. Report false if the user is not able/allowed to share files/folders. Currently this would be because the user is in a group that is excluded from sharing, or sharing is completely disabled. In future there might be other settings that also contribute to the final decision as to if can_share is true or ``false```.

Related Issue

#31817

Derived from issue #31576 and PR #31580

Motivation and Context

It is nice if clients can find out if the current user is able to share. For example, a client could examine the other capabilities and see that sharing is enabled etc. But the user could be in a group that is excluded from sharing, so actually for that user there is no point in the client letting them attempt to share stuff.

How Has This Been Tested?

Acceptance tests run locally.

During running the acceptance tests locally, the last scenario capabilities.feature:559 was failing. I discovered that function isSharingDisabledForUser() in lib/private/legacy/util.php had not had the new logic put in it. See 2nd commit that makes that fix.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@codecov
Copy link

codecov bot commented Jun 18, 2018

Codecov Report

Merging #31816 into master will decrease coverage by 15.49%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #31816      +/-   ##
============================================
- Coverage     63.24%   47.75%   -15.5%     
============================================
  Files          1158      109    -1049     
  Lines         69305    10364   -58941     
  Branches       1261     1261              
============================================
- Hits          43830     4949   -38881     
+ Misses        25105     5045   -20060     
  Partials        370      370
Flag Coverage Δ Complexity Δ
#javascript 52.47% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 37.31% <ø> (-27.16%) 0 <ø> (-18455)
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/Storage/DAV.php 59.45% <0%> (-21.22%) 0% <0%> (ø)
apps/federation/lib/SyncJob.php
apps/files_trashbin/appinfo/routes.php
core/Command/Check.php
apps/comments/lib/Dav/EntityCollection.php
lib/private/Repair/RepairUnmergedShares.php
apps/files_sharing/ajax/external.php
apps/files_versions/lib/Storage.php
apps/files/lib/Command/DeleteOrphanedFiles.php
apps/dav/lib/Upload/ChunkLocationProvider.php
... and 1037 more

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 a75f9be...73ab4fa. Read the comment docs.

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍 thanks

@phil-davis
Copy link
Contributor Author

Backport stable10 #31824

@lock
Copy link

lock bot commented Jul 30, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 30, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants