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

Fix #180. Filter properly user rules in RESTServiceImpl #181

Merged
merged 1 commit into from
May 15, 2018

Conversation

offtherailz
Copy link
Member

Actually Access rules from ResourceDAOImpl.findUserSecurityRule returns all rules available instead of returning rules that match user and .
RESTServiceImpl expects only to find only one result (that is not properly correct because there is not any check about unique rules for same user/resource), so it gets the first rule available and checks this rule to find out read or write access information. But because of the bug above, any rule found on the db before the user's one is valid. So it returns true anyway.

I changed this behavior to check all rules returned by the ResourceDAOImpl and ignore the ones not referred to the user.

NOTE: I implemented a fix that ignores not valid rules in RESTServiceImpl because this part is testable ( test ResourceDAOImpl is hard instead) and because ResourceDAOImpl.findUserSecurityRule is deprecated, so it's not too useful maintain it.

@ghost ghost assigned offtherailz May 15, 2018
@ghost ghost added the review label May 15, 2018
@coveralls
Copy link

coveralls commented May 15, 2018

Coverage Status

Coverage increased (+0.7%) to 32.712% when pulling 99a7c4c on offtherailz:fix_#180 into d4b6dff on geosolutions-it:master.

@offtherailz offtherailz requested a review from mbarto May 15, 2018 14:32
@offtherailz offtherailz merged commit ed61515 into geosolutions-it:master May 15, 2018
@ghost ghost removed the review label May 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants