dataforgoodfr / dataforgoodfr/14_Data4Trees

Feature: Intercept style.json request in Django and filter data according to user (project / rights)

Open
#111 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

D4T_Backend P2
Dominant language
TypeScript
Stars
9
Forks
0
Avg merge
10d 11h
Merged PRs (30d)
4

Description

Objective

The goal is to display different data on the map based on the user that is logged in.
The website will handle form data uploaded y different actors from different associations.
Globally, there are 3 kinds of forms.
Locally, there will be several projects using the same forms to monitor biodiversity indicators.
When a user from project ABC logged into the website, only data from project ABC is displayed on the map.
When a user with admin rights logs into the website, all data is displayed on the map
When a user is not logged in , only public data will be shown (still unclear what will be public / private)

Context

Before creating the map, the frontend sens a request to the backend to retrieve the style.json using this endpoint : api/maps/style.json (view is my_map_view in maps.
The django backend directly sends this request to coordo using handleRequest method and the return the data as is.
The goal of this ticket is to add a fitlering step before returning the Json response, to filter the sources with data only from the project in which the user participates.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the my_map_view view in maps, the api/maps/style.json endpoint, and the handleRequest method that forwards the response to coordo. Trace how the logged-in user’s project and rights are available before the style JSON is returned. Done means sources are filtered for project users, admins see all data, and unauthenticated visibility is resolved and covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
api, authentication, authorization, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.