arturobernalg opened a new pull request, #590: URL: https://github.com/apache/jspwiki/pull/590
Stacked on https://github.com/apache/jspwiki/pull/589: until that one is merged, the first two commits are the ones of that pull request, and the one of this pull request is the last one. Second step of https://issues.apache.org/jira/browse/JSPWIKI-1310. It adds GET /api/v1/search/suggestions, with the query parameters query and max, and GET /api/v1/plugins, to the contract openapi.yaml and to ApiV1Servlet. Both answer as the search does: 401 to an anonymous caller without permission, 403 to a logged in one, and 400 with a JSON body when query is missing or max is not a positive integer. The suggestions leave out the pages the caller may not view. The suggestions of /ajax/search/suggestions do not do that, and the question was open on dev@, so I took the safe side for the new endpoint. For that, SearchManager has a new method, suggestPages(text, max, session). The algorithm moved from the Ajax service to a private method that both use, and the Ajax service calls it without a filter, so its behaviour does not change. The plugins are sorted by display name for the locale of the request, as in /ajax/plugins/plugins, but on a copy of the list of the plugin manager, because the Ajax service sorts the list of the manager itself. The test compares each answer with openapi.yaml, as for the search. Checked locally: jspwiki-main 1055 tests pass, 7 of them new; making the suggestions ignore the permission makes the test fail; and on a running war (Tomcat 10.1) with three pages, one of them with [{ALLOW view Admin}], the anonymous caller does not get that one, max works, and the plugins come sorted. Not tested: login, logout and /pages/{page}, which are not implemented yet, and the integration tests. The ChangeLog entry comes in a separate commit with the number of this pull request. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
