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

fix permissions of mountpoints - take 2 #4685

Merged
merged 3 commits into from
May 15, 2017
Merged

fix permissions of mountpoints - take 2 #4685

merged 3 commits into from
May 15, 2017

Conversation

rullzer
Copy link
Member

@rullzer rullzer commented May 4, 2017

#4623 + fix for the test.

This reverts commit 70a0e9c.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
A moveable mount point (What a SharedStorage is) always has DELETE +
UPDATE permissions. Since you can either delete (unshare) or update
(rename) it.

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
@rullzer rullzer added the 3. to review Waiting for reviews label May 4, 2017
@rullzer rullzer added this to the Nextcloud 12.0 milestone May 4, 2017
@mention-bot
Copy link

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

@rullzer
Copy link
Member Author

rullzer commented May 4, 2017

Mmmm the integration tests are not happy... lets see why

@rullzer
Copy link
Member Author

rullzer commented May 4, 2017

Ah go it...

$data['permissions'] |= \OCP\Constants::PERMISSION_DELETE;
if ($internalPath === '') {
if ($mount instanceof MoveableMount) {
$data['permissions'] = $data['permissions'] | \OCP\Constants::PERMISSION_UPDATE | \OCP\Constants::PERMISSION_DELETE;
Copy link
Member Author

Choose a reason for hiding this comment

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

@icewind1991 because you added the PERMISSION_UPDATE here it fails for shared files.

  1. user0 has foo.txt
  2. user0 shares foo.txt to user1 with READ+SHARE permissions
  3. user1 shares foo.txt to user2 with READ+SHARE+UPDATE permissions

This now works because well the mountpoint gets update permissions.

@@ -210,7 +210,7 @@ public function testGetPermissions() {
// the read permissions (1)
// the delete permission (8), to enable unshare
$rootInfo = \OC\Files\Filesystem::getFileInfo($this->folder);
$this->assertSame(9, $rootInfo->getPermissions());
$this->assertSame(\OCP\Constants::PERMISSION_READ | \OCP\Constants::PERMISSION_DELETE | \OCP\Constants::PERMISSION_UPDATE, $rootInfo->getPermissions());
Copy link
Member

Choose a reason for hiding this comment

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

Then also update the comment above

Copy link
Member

Choose a reason for hiding this comment

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

done

Signed-off-by: Robin Appelman <robin@icewind.nl>
@codecov
Copy link

codecov bot commented May 15, 2017

Codecov Report

Merging #4685 into master will increase coverage by <.01%.
The diff coverage is 100%.

@@             Coverage Diff              @@
##             master    #4685      +/-   ##
============================================
+ Coverage     54.28%   54.28%   +<.01%     
  Complexity    22098    22098              
============================================
  Files          1361     1361              
  Lines         84710    84712       +2     
  Branches       1324     1324              
============================================
+ Hits          45982    45984       +2     
  Misses        38728    38728
Impacted Files Coverage Δ Complexity Δ
lib/private/Files/View.php 85.95% <100%> (+0.02%) 362 <0> (ø) ⬇️

Copy link
Member

@MorrisJobke MorrisJobke left a comment

Choose a reason for hiding this comment

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

Tested and works 👍

@MorrisJobke MorrisJobke merged commit ad0d0b0 into master May 15, 2017
@MorrisJobke MorrisJobke deleted the fix_4683 branch May 15, 2017 16:54
@MorrisJobke
Copy link
Member

Damn ... I have overseen this failure:

  Scenario: User is not allowed to reshare file with more permissions # /drone/src/github.com/nextcloud/server/build/integration/features/sharing-v1-part2.feature:161
    As an "admin"
    Given user "user0" exists                                         # FeatureContext::assureUserExists()
    And user "user1" exists                                           # FeatureContext::assureUserExists()
    And user "user2" exists                                           # FeatureContext::assureUserExists()
    And As an "user0"                                                 # FeatureContext::asAn()
    And creating a share with                                         # FeatureContext::creatingShare()
      | path        | /textfile0.txt |
      | shareType   | 0              |
      | shareWith   | user1          |
      | permissions | 16             |
    And As an "user1"                                                 # FeatureContext::asAn()
    When creating a share with                                        # FeatureContext::creatingShare()
      | path        | /textfile0 (2).txt |
      | shareType   | 0                  |
      | shareWith   | user2              |
      | permissions | 31                 |
    Then the OCS status code should be "404"                          # FeatureContext::theOCSStatusCodeShouldBe()
      Failed asserting that SimpleXMLElement Object &000000003dc84ddf0000000001761b42 (
          0 => '100'
      ) matches expected '404'.
    And the HTTP status code should be "200"                          # FeatureContext::theHTTPStatusCodeShouldBe()

@rullzer could you have a look?

@MorrisJobke
Copy link
Member

Looks like an actual bug :/

@rullzer
Copy link
Member Author

rullzer commented May 15, 2017

Yeah please revert. As we need to fix that properly our users can increase shared file permissions

@MorrisJobke
Copy link
Member

Yeah please revert. As we need to fix that properly our users can increase shared file permissions

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants