Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[feature] Allow viewing shared objects by non superadministrators as view only

Aperta
#1,013 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
django, python

Direzione di ricerca

Leggi la soluzione collegata dall’issue 238, quindi esamina openwisp_controller/pki/api/serializers.py alla riga di CaListSerializer citata nel report. Individua i test dell’admin e della REST API per gli oggetti condivisi, oppure la logica di test riutilizzabile già esistente. Il lavoro è completato quando gli oggetti condivisi sono visualizzabili dagli utenti non superuser, mentre la creazione, la modifica e l’eliminazione rimangono limitate ai superuser in entrambe le interfacce, con copertura per ogni modello.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

⚠️ Not suited to beginner contributors.

Implement the solution devised in https://github.com/openwisp/openwisp-users/issues/238.

We must add tests (ideally reusable test logic to make maintainance sane) that for each model verify the following:

  • shared objects can be viewed in readonly mode also by non superusers (admin and REST API)
  • new shared object can be created only by superusers (admin and REST API)
  • existing shared objects can only be changed/deleted by superusers (admin and REST API)

I found that after upgrading DRF to 3.16 endpoints using the CaListSerializer were failing with the following error:

assert not (required and default is not empty), NOT_REQUIRED_DEFAULT
AssertionError: May not set both `required` and `default`

It happens because of this line:
https://github.com/openwisp/openwisp-controller/blob/1745a0a04f43708d7b402a292d208ca20a010376/openwisp_controller/pki/api/serializers.py#L81

If I remove that line, the tests pass, but I am then able to create a shared Ca with a non superuser org admin/manager user account, which is not what we want and is worrying: we need tests to protect us from these possible security holes.
I also verified that upgrading to DRF 3.16 allows to create objects by omitting the "organization" field, hence allowing non superusers to omit this field and create shared objects, opening security holes.

I think it may be necessary to work on these changes while also upgrading DRF to 3.16 and bind the version, otherwise we may have to work on this twice.

Lingua principale
Python
Stelle
779
Fork
328
Merge medio
2g 19h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di openwisp/openwisp-controller

Tutte le issue di openwisp/openwisp-controller

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.