Skip to content

Conversation

@PVince81
Copy link
Contributor

@PVince81 PVince81 commented Aug 8, 2017

Description

Default share permissions setting for local shares.

The default permissions are exposed via capabilities.
To make it visible to the JS frontend code, the capabilities are now added in "js/config.php" and accessible through OC.getCapabilities(). This will make passing such config values more convenient in the future especially for values that other clients need.

Related Issue

Fixes #28384.

Motivation and Context

See ticket

How Has This Been Tested?

  • TEST: manual testing
  • TEST: add unit tests

Screenshots (if appropriate):

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.

@PVince81 PVince81 added this to the development milestone Aug 8, 2017
@PVince81 PVince81 self-assigned this Aug 8, 2017
@PVince81 PVince81 added the p1-urgent Critical issue, need to consider hotfix with just that issue label Sep 1, 2017
@PVince81
Copy link
Contributor Author

PVince81 commented Sep 1, 2017

spectacle x10222

@felixheidecke any hint to make it look a bit more beautiful ? Since there is no main checkbox I thought maybe to just add a bullet there ?

cc @pmaier1

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 1, 2017

talking about the "Default share permissions" section

Vincent Petry added 4 commits September 1, 2017 12:30
Capabilities are computed in js/config.php and stored in oc_capabilities
and accessible under OC.getCapabilities() on the JS side.

This is only exposed if the user has logged in.
@PVince81
Copy link
Contributor Author

PVince81 commented Sep 1, 2017

Alternative layout (not committed):
spectacle b13175

@PVince81 PVince81 force-pushed the default-share-perms branch from 9e5d9be to a186fa1 Compare September 1, 2017 10:36
@PVince81
Copy link
Contributor Author

PVince81 commented Sep 1, 2017

Test plan

Set default perms in settings page to "can create" and "can update" only

  • TEST: creating a user share in web UI uses default perm
  • TEST: capability API returns default perm 7
  • TEST: create a user share with OCS API without giving a permission value: curl -u admin:admin -H 'Content-Type:application/x-www-form-urlencoded' -H 'OCS-APIREQUEST:true' -X POST 'http://localhost/owncloud/ocs/v1.php/apps/files_sharing/api/v1/shares' --data-binary 'path=/test&shareType=0&shareWith=user3' => result returns default perm instead of 31, web UI shows that the perm was applied correctly

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 1, 2017

Oh, legit test failures on Jenkins. It's been a while I haven't seen that:

Tests\Settings\Panels\Admin\FileSharingTest.testGetSection
    Tests\Settings\Panels\Admin\FileSharingTest.testGetPriority
    Tests\Settings\Panels\Admin\FileSharingTest.testGetPanelEnabled
    OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate.testPublicLinkExpireDate with data set #0
    OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate.testPublicLinkExpireDate with data set #1
    OCA\Files_Sharing\Tests\ApiTest::testPublicLinkExpireDate.testPublicLinkExpireDate with data set #2
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareUserFile
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareUserFolder
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareGroupFile
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareGroupFolder
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareLink
    OCA\Files_Sharing\Tests\ApiTest.testCreateShareLinkPublicUpload
    OCA\Files_Sharing\Tests\ApiTest.testEnfoceLinkPassword
    OCA\Files_Sharing\Tests\ApiTest.testSharePermissions
    OCA\Files_Sharing\Tests\ApiTest.testGetAllShares
    OCA\Files_Sharing\Tests\ApiTest.testGetAllSharesWithMe
    OCA\Files_Sharing\Tests\ApiTest.testPublicLinkUrl
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromFolder
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromFolderWithFile
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromFolderReshares
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromSubFolderReShares
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromFolderReReShares
    OCA\Files_Sharing\Tests\ApiTest.testGetShareMultipleSharedFolder
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromFileReReShares
    OCA\Files_Sharing\Tests\ApiTest.testGetShareFromUnknownId
    OCA\Files_Sharing\Tests\ApiTest.testUpdateShareUpload
    OCA\Files_Sharing\Tests\ApiTest.testUpdateShareExpireDate
    OCA\Files_Sharing\Tests\ApiTest.testDeleteReshare
    OCA\Files_Sharing\Tests\ApiTest.testDefaultExpireDate
    OCA\Files_Sharing\Tests\ApiTest.testCreatePublicLinkExpireDateValid
    OCA\Files_Sharing\Tests\ApiTest.testCreatePublicLinkExpireDateInvalidFuture
    OCA\Files_Sharing\Tests\ApiTest.testCreatePublicLinkExpireDateInvalidPast
    OCA\Files_Sharing\Tests\ApiTest.testInvisibleSharesUser
    OCA\Files_Sharing\Tests\ApiTest.testInvisibleSharesGroup
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #0
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #1
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #2
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #3
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #4
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #5
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #6
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #7
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #8
    OCA\Files_Sharing\Tests\ExpireSharesJobTest::testExpireLinkShare.testExpireLinkShare with data set #9

@jvillafanez
Copy link
Member

👍 for the code. We still need to check the failing unittests and the style

@pmaier1
Copy link
Contributor

pmaier1 commented Sep 2, 2017

Nice! Some UI feedback:

  • IMO it would fit best at the bottom of the sharing section. This would also make the missing main checkbox less noticeable. Why did you put it in the middle? For that I would also maybe prefer the second layout.
  • In the headline, I think the term 'local' could be confusing. It could say 'Default user and group share permissions'?
  • Consistency: The checkbox for 'update' is called 'change' in the sharing tab. In general I find that one confusing because if I can change it, I can also delete it's contents but that's another story ;)

@tomneedham
Copy link
Contributor

UI wise, I prefer the uncommitted proposed design, but at the bottom of the sharing settings

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 4, 2017

the uncommitted proposed design

@tomneedham they have swapped roles. The committed one is now the one with the aligned checkboxes on a single row.

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 4, 2017

Adjusted according to @pmaier1's comments.

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 4, 2017

spectacle ea7772

@PVince81
Copy link
Contributor Author

PVince81 commented Sep 4, 2017

stable10: #28903

(am optimistic about CI)

@PVince81 PVince81 merged commit 916afbd into master Sep 4, 2017
@PVince81 PVince81 deleted the default-share-perms branch September 4, 2017 19:28
@lock
Copy link

lock bot commented Aug 2, 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 Aug 2, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

4 - To release p1-urgent Critical issue, need to consider hotfix with just that issue status/STALE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make sharing permission defaults configurable

7 participants