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

[stable10] Backport of Fix static tags filtering in the backend #34557

Merged
merged 1 commit into from
Feb 19, 2019

Conversation

sharidas
Copy link
Contributor

Fix static tags filtering in the backend.

Signed-off-by: Sujith H [email protected]

Description

Static tags filtering was done in the frontend #34116. We need to do this in the backend. The filtering is done in the method getchildren(). If th user does not have privilege to see the static tags, in the search, then it should be hidden for him/her.

Related Issue

Motivation and Context

The backend should provide the tags which could be viewed by the user. Basically it helps the UI to filter it out.

How Has This Been Tested?

    • Create 3 users admin, user1 and user2.
  • Create 2 groups group1 and assign user1 to it. user2 is assigned to group2.
  • As admin user create 4 tags visibleTag, restrictTag ( group1 is assgined to it ), staticTag ( group2 is assigned to it) , invisibleTag.
  • Login as user2 and navigate to tags page, the user would see staticTag
    • response captured from the dev console
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/</d:href>
    <d:propstat>
      <d:prop>
        <oc:id/>
        <oc:display-name/>
        <oc:user-visible/>
        <oc:user-editable/>
        <oc:user-assignable/>
        <oc:editable-in-group/>
        <oc:can-assign/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/2</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>2</oc:id>
        <oc:display-name>restrictTag</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-editable>false</oc:user-editable>
        <oc:user-assignable>false</oc:user-assignable>
        <oc:editable-in-group>false</oc:editable-in-group>
        <oc:can-assign>false</oc:can-assign>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/3</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>3</oc:id>
        <oc:display-name>staticTag</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-editable>false</oc:user-editable>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:editable-in-group>true</oc:editable-in-group>
        <oc:can-assign>true</oc:can-assign>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/1</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>1</oc:id>
        <oc:display-name>visibleTag</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-editable>true</oc:user-editable>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:editable-in-group>false</oc:editable-in-group>
        <oc:can-assign>true</oc:can-assign>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>
  • Login as user1 and navigate to tags page, the user would not see staticTag.
    • response captured from the dev console
<?xml version="1.0"?>
<d:multistatus xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns" xmlns:oc="http://owncloud.org/ns">
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/</d:href>
    <d:propstat>
      <d:prop>
        <oc:id/>
        <oc:display-name/>
        <oc:user-visible/>
        <oc:user-editable/>
        <oc:user-assignable/>
        <oc:editable-in-group/>
        <oc:can-assign/>
      </d:prop>
      <d:status>HTTP/1.1 404 Not Found</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/2</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>2</oc:id>
        <oc:display-name>restrictTag</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-editable>false</oc:user-editable>
        <oc:user-assignable>false</oc:user-assignable>
        <oc:editable-in-group>true</oc:editable-in-group>
        <oc:can-assign>true</oc:can-assign>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
  <d:response>
    <d:href>/testing2/remote.php/dav/systemtags/1</d:href>
    <d:propstat>
      <d:prop>
        <oc:id>1</oc:id>
        <oc:display-name>visibleTag</oc:display-name>
        <oc:user-visible>true</oc:user-visible>
        <oc:user-editable>true</oc:user-editable>
        <oc:user-assignable>true</oc:user-assignable>
        <oc:editable-in-group>false</oc:editable-in-group>
        <oc:can-assign>true</oc:can-assign>
      </d:prop>
      <d:status>HTTP/1.1 200 OK</d:status>
    </d:propstat>
  </d:response>
</d:multistatus>

Screenshots (if appropriate):

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:

Open tasks:

  • Backport (if applicable set "backport-request" label and remove when the backport was done)

Fix static tags filtering in the backend.

Signed-off-by: Sujith H <[email protected]>
@sharidas sharidas added this to the development milestone Feb 19, 2019
@sharidas sharidas self-assigned this Feb 19, 2019
@sharidas sharidas requested a review from PVince81 February 19, 2019 13:28
@sharidas
Copy link
Contributor Author

Original PR #34547

@codecov
Copy link

codecov bot commented Feb 19, 2019

Codecov Report

Merging #34557 into stable10 will decrease coverage by <.01%.
The diff coverage is 42.85%.

Impacted file tree graph

@@              Coverage Diff               @@
##             stable10   #34557      +/-   ##
==============================================
- Coverage       63.93%   63.92%   -0.01%     
- Complexity      19146    19150       +4     
==============================================
  Files            1269     1269              
  Lines           75553    75559       +6     
  Branches         1293     1293              
==============================================
- Hits            48303    48301       -2     
- Misses          26869    26877       +8     
  Partials          381      381
Flag Coverage Δ Complexity Δ
#javascript 53.29% <ø> (ø) 0 <ø> (ø) ⬇️
#phpunit 65.06% <42.85%> (-0.01%) 19150 <0> (+4)
Impacted Files Coverage Δ Complexity Δ
...pps/dav/lib/SystemTag/SystemTagsByIdCollection.php 81.03% <42.85%> (-5.25%) 25 <0> (+4)
apps/encryption/templates/settings-admin.php 88.23% <0%> (-5.89%) 0% <0%> (ø)
apps/encryption/lib/Session.php 98.03% <0%> (-1.97%) 22% <0%> (ø)
apps/files_trashbin/lib/Expiration.php 96.55% <0%> (-1.73%) 29% <0%> (ø)
...eratedfilesharing/lib/Controller/OcmController.php 66.06% <0%> (-0.21%) 30% <0%> (ø)
lib/private/Server.php 84.75% <0%> (-0.14%) 129% <0%> (ø)

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 bef80b2...7385dc5. 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.

👍

@PVince81 PVince81 merged commit 837c62b into stable10 Feb 19, 2019
@PVince81 PVince81 deleted the static-tags-filtering-backend-stable10 branch February 19, 2019 15:28
@PVince81 PVince81 modified the milestones: development, QA Apr 12, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2020
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