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

Update to use capabilities queries #93

Merged
merged 9 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache-dir.outputs.dir }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }}
key: ${{ runner.os }}-composer-${{ matrix.php }}-${{ hashFiles('composer.lock') }}-wp5.9

- name: Install PHP Dependencies
run: |
Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@
"phpcompatibility/phpcompatibility-wp": "2.1.0",
"phpstan/phpstan": "0.12.57",
"phpunit/phpunit": "^7",
"roots/wordpress": "~5.7.0",
"roots/wordpress": "~5.9.0",
"squizlabs/php_codesniffer": "3.5.8",
"szepeviktor/phpstan-wordpress": "0.7.1",
"vlucas/phpdotenv": "^3",
"wp-cli/db-command": "^2",
"wp-phpunit/wp-phpunit": "~5.7.0"
"wp-phpunit/wp-phpunit": "~5.9.0",
"yoast/phpunit-polyfills": "^1.0"
},
"config": {
"preferred-install": "dist",
Expand Down
100 changes: 89 additions & 11 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions inc/class-users-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function get_items_permissions_check( $request ) {

if (
$request->get_param( 'slug' ) ||
$request->get_param( 'capabilities' ) ||
$request->get_param( 'who' ) ||
$request->get_param( 'roles' )
) {
Expand Down Expand Up @@ -289,6 +290,7 @@ public function get_collection_params() {
unset(
$query_params['context'],
$query_params['slug'],
$query_params['capabilities'],
$query_params['who'],
$query_params['roles']
);
Expand Down
3 changes: 3 additions & 0 deletions tests/phpunit/test-rest-api-user-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ public function dataDisallowedFilters() : array {
[
'slug',
],
[
'capabilities',
],
[
'who',
],
Expand Down