Update backend services, user right tests and user right documentation#1217
Merged
Conversation
This was
linked to
issues
Jun 30, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates backend authorization behavior and aligns API tests + documentation with the current user-rights model (notably around EditRestricted behavior and occurrence/cross-search access).
Changes:
- Hardened EditRestricted locality write permission checks to prevent gaining access by adding project links during an edit.
- Refactored/expanded backend API tests (locality update, species merge, collecting method values) to better cover user-right scenarios.
- Updated user-rights documentation with an Occurrence (Cross-Search) section and minor formatting cleanups.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| documentation/user_rights.md | Adds/adjusts documentation for occurrence/cross-search access and formatting. |
| backend/src/services/locality.ts | Tightens EditRestricted write permission logic for locality updates. |
| backend/src/api-tests/species/merge.test.ts | Refactors merge tests and adds explicit non-admin/anonymous rejection coverage. |
| backend/src/api-tests/locality/update.test.ts | Restructures locality update tests and adds permission-related cases for EditRestricted/anonymous. |
| backend/src/api-tests/locality/data.ts | Moves locality-species test payload details out of shared fixture to the test setup. |
| backend/src/api-tests/crossSearch/get.test.ts | Minor test description adjustment. |
| backend/src/api-tests/collectingMethodValues/getAll.test.ts | Updates auth coverage to include anonymous rejection and edit-role acceptance. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
… membership requirements by adding new projects when updating a project, and add tests
juhanikat
force-pushed
the
update-user-rights-tests
branch
from
July 12, 2026 12:11
c5e6615 to
3152270
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 23 out of 23 changed files in this pull request and generated 4 comments.
Comments suppressed due to low confidence (1)
backend/src/api-tests/collectingMethodValues/getAll.test.ts:41
- This test only verifies that anonymous users are rejected and that EditRestricted/EditUnrestricted users are accepted, but it no longer checks that a logged-in user without the required roles (e.g. Role.Project/testPl) is rejected. The route is protected by requireOneOf([Admin, EditUnrestricted, EditRestricted]) (backend/src/routes/collectingMethodValues.ts:8-12), so a negative case should be covered here.
it('accepts users with locality edit access', async () => {
await login('testEr', 'test')
const { status: erStatus } = await send('collecting-method-values/all', 'GET')
expect(erStatus).toBe(200)
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
juhanikat
marked this pull request as ready for review
July 20, 2026 12:00
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.
No description provided.