Repository navigation
Restrict user and user group management API to administrators - #220
Merged
Merged
Conversation
Users and user groups can be created, changed or deleted only by admins (as in the UI); users can still change their own password through changepassword. Users can read only themselves and their related groups. The 127.0.0.1 bypass on /api/** now applies only in development mode, and logo upload requires the admin role.
Survey, record, command, record file, backup/restore and geo endpoints now check that the logged user can access the survey (survey user group member or admin) and has the permissions the UI requires for the operation (same rules as frontend User.js, ported to RecordAccessControlManager). Record summaries are filtered by the logged user instead of a client-supplied user. Backup/restore is admin only and remote restore is refused when no restore key is configured. /api/datacleansing requires the CLEANSING role.
…cords # Conflicts: # collect-server/src/main/java/org/openforis/collect/web/controller/CommandController.java
…cords Use constructor injection for AccessControl in all controllers (the merged branch introduced it for AccessControl and the user controllers) and fix the Sonar test issues (@mock fields, single invocation in assertThrows lambdas).
Check survey and record access in data and survey API
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Method security is not enabled (
<global-method-security>is commented out), so@Securedannotations had no effect and any logged user could use the user and user group management API.AccessControlbean: checks on the user logged in the session, throwsAccessDeniedException(403)./uploadLogo.htmrequires ADMIN (the existing rule protected/logoUpload, a different path)./api/**from 127.0.0.1 now applies only in development mode.Test:
AccessControlTest.