EnviDat / ckanext-restricted

CKAN extension for restricting access to resources
GNU Affero General Public License v3.0
7 stars 26 forks source link

Speeding up package search requests #25

Open jonathansberry opened 3 years ago

jonathansberry commented 3 years ago

Hi there,

We're using a fork of ckanext-restricted, thanks for the good work in preparing the repo.

I'm puzzled by the following line: https://github.com/EnviDat/ckanext-restricted/blob/4cdf939f6d9166534f7594a4de1b538b03cedf2a/ckanext/restricted/action.py#L192

Can you give some further info on it's purpose? The output of the line appears to be ignored by the code. Removing the line doesn't break any tests, and at the moment I haven't been able to see that it has any impact on the UI or api requests.

Is it's job to raise some exceptions? I can see that during execution of this line check_access is called for the "package_show" action on the resource's parent pacakge, however, any exceptions raised by this are not caught which seems slightly odd to me - I wouldn't want someone to be unauthorised to view all their search results just because they don't have access to view one of their search results.

...maybe I'm missing something obvious!

We're having problems with ckanext-requests slowing down package_search requests. By my reckoning this line is slowing down package_search requests by a factor >4x what it is without the line, so I want to be clear on why it is there.

Jonathan Berry fjelltopp.org

espona commented 3 years ago

Hi Jonathan,

It may be a deprecated line from the previous version that was even slower. We are quite short on resources to work on this package. I will try to find some time to check on this next week, but please if you consider you have done enough testing you can do a pull request.

Thanks a lot for your contribution, Lucia