Skip to content

Add pagination/search through REPORT - #27

Merged
PVince81 merged 2 commits into
masterfrom
report-pagination
Mar 1, 2017
Merged

PVince81 merged 2 commits into
masterfrom
report-pagination

Conversation

@PVince81

Copy link
Copy Markdown
Contributor

Fixes #16

Example report:

<?xml version="1.0" encoding="utf-8" ?>
<oc:search-query xmlns:a="DAV:" xmlns:oc="http://owncloud.org/ns">
        <a:prop>
                <oc:role></oc:role>
                <oc:display-name></oc:display-name>
        </a:prop>
        <oc:search>
                <oc:pattern>us</oc:pattern>
                <oc:limit>5</oc:limit>
                <oc:offset>0</oc:offset>
        </oc:search>
</oc:search-query>

You can apply this to the following URLs:

  • groups list: curl -i --data-binary "@report-customgroups.xml" -X REPORT -H "Content-Type: text/xml" http://admin:admin@localhost/owncloud/remote.php/dav/customgroups/groups
  • group members list: curl -i --data-binary "@report-customgroups.xml" -X REPORT -H "Content-Type: text/xml" http://admin:admin@localhost/owncloud/remote.php/dav/customgroups/groups/group1
  • user membership list: curl -i --data-binary "@report-customgroups.xml" -X REPORT -H "Content-Type: text/xml" http://admin:admin@localhost/owncloud/remote.php/dav/customgroups/users/user1/

@DeepDiver1975 @jvillafanez please review.

If the implementation style is ok I'll add matching unit tests.

  • unit tests

@PVince81 PVince81 added this to the 10.0 milestone Feb 23, 2017
@PVince81 PVince81 mentioned this pull request Feb 23, 2017
@PVince81
PVince81 force-pushed the report-pagination branch 2 times, most recently from 6e6e790 to 58f7ef4 Compare February 27, 2017 10:37
@PVince81

Copy link
Copy Markdown
Contributor Author

Do we agree on the general approach so I can solidify this with unit tests ?

Comment thread lib/CustomGroupsDatabaseHandler.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this needs to be changed

Comment thread lib/CustomGroupsDatabaseHandler.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

that lower function is strictly needed?. Although it might not be risky, the behaviour isn't optional and isn't documented.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's how we did search in the default group backend. I think it makes sense to keep it.

Comment thread lib/CustomGroupsDatabaseHandler.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm not sure if we can switch the roleFilter and search parameters at this point. I've seen too much getUserMembership(uid, null, search). A getUserMembership(uid, search) with the roleFilter as null by default looks better.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I also hesitated to maybe put the role filter as a member of the Search class, what do you think ?

@jvillafanez

Copy link
Copy Markdown
Member

The approach looks good to me.

@PVince81

Copy link
Copy Markdown
Contributor Author

@jvillafanez thanks a lot for your feedback !

I have the feeling that having a Search object is the way to go in the future for any paginated queries as it saves having a lot of arguments.

@PVince81

PVince81 commented Feb 28, 2017 •

Copy link
Copy Markdown
Contributor Author
  • fix DB handler unit tests
  • add tests for REPORT
  • include roleFilter in the Search class and REPORT args ?

@PVince81

PVince81 commented Feb 28, 2017 •

Copy link
Copy Markdown
Contributor Author
  • unit tests for ->search() method on nodes

@PVince81

Copy link
Copy Markdown
Contributor Author

Ok, I'll try adding roleFilter into the Search object. It should work in most queries.

@PVince81
PVince81 force-pushed the report-pagination branch 2 times, most recently from e31f275 to 7ddc303 Compare February 28, 2017 18:48
@PVince81

Copy link
Copy Markdown
Contributor Author

This is ready for review now

@PVince81

Copy link
Copy Markdown
Contributor Author

Unit tests added + a few tweaks

Comment thread lib/CustomGroupsBackend.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

too many nulls here

Comment thread lib/Dav/GroupMembershipCollection.php Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

are the parameters correct?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

uh oh... why didn't the tests explode... I'll recheck

@PVince81
PVince81 force-pushed the report-pagination branch from 7ddc303 to fdab5a5 Compare March 1, 2017 08:40
@PVince81

PVince81 commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author

@jvillafanez fixed now...

The reason why tests passed is because the expectation was also wrong...

@jvillafanez

Copy link
Copy Markdown
Member

👍

@PVince81

PVince81 commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author

and now Travis is imitating Jenkins it seems. It's been an hour and I still can't see any results (loading forever)

@PVince81

PVince81 commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author
    /home/travis/build/owncloud/core/apps/customgroups/tests/integration/custom_groups_features/CustomGroups.feature:147

    /home/travis/build/owncloud/core/apps/customgroups/tests/integration/custom_groups_features/CustomGroups.feature:159

@PVince81

PVince81 commented Mar 1, 2017

Copy link
Copy Markdown
Contributor Author

Going to merge this anyway now and resolve conflicts and integration tests as part of #26

@PVince81
PVince81 merged commit 3f66a22 into master Mar 1, 2017
@PVince81
PVince81 deleted the report-pagination branch March 1, 2017 13:48
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.

2 participants