• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akvo / akvo-mis / #773
89%
main: 89%

Build:
Build:
LAST BUILD BRANCH: feature/273-two-phase-registration
DEFAULT BRANCH: main
Ran 30 Jul 2026 07:14AM UTC
Jobs 1
Files 113
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

30 Jul 2026 07:05AM UTC coverage: 88.786% (+0.3%) from 88.523%
#773

Pull #280

coveralls-python

web-flow
[#271] Enforce tenant ownership on every write (#282)

* [#271] Add the tenant stamping mixin and scoped related field

Two write-side mechanisms mirroring the read-side for_user. The
stamping mixin sets a new row's tenant from the authenticated user
(never the payload) in create(). The scoped related field narrows a
foreign-key input's candidates to for_user(user), so a pk pointing at
another tenant's object fails validation as does_not_exist. Both
resolve the acting user from either the "user" or the DRF "request"
context key.

A test covers the case that matters most for trust: a payload carrying
an explicit tenant id is ignored, and the row is stamped to the caller.

* [#271] Stamp direct-FK creates with the creator's tenant

Form, organisation, user, entity, attribute and single-administration
creates now set tenant from the authenticated user. Rows that landed
tenant-less before were invisible to their own creator the moment read
filtering arrived — a form saved in the builder and vanished. A test
covers exactly that: create, then list, and find it.

The plan expected two variants, the mixin where create() is default and
explicit assignment where it is overridden. Only the mixin is needed:
all three custom create() methods call super().create(), so the mixin
sits behind them in the MRO and stamps on the way through. One
mechanism, applied uniformly.

Two unscoped level lookups had to be fixed to get here. validate_parent
and _assign_level both resolved the child tier with
Levels.objects.get(level=n), which is unique per tenant but not
globally: with a second tenant present they matched two rows and raised
MultipleObjectsReturned, so creating any child administration was a 500
rather than a leak. Both now resolve within the parent's tenant. Read
filtering missed them because they live in a serializer validator, not
a view queryset.

* [#271] Reject write payloads referencing another tenant's objects

Foreign-key inputs to tenant-owned objects — a... (continued)
Pull Request #280: Epic/multi tenant saas

5733 of 6629 branches covered (86.48%)

Branch coverage included in aggregate %.

10877 of 12079 relevant lines covered (90.05%)

0.9 hits per line

Coverage Regressions

Lines Coverage ∆ File
57
80.47
0.29% api/v1/v1_forms/views.py
54
85.64
0.51% api/v1/v1_users/serializers.py
40
91.03
0.03% api/v1/v1_forms/functions.py
39
85.46
1.97% api/v1/v1_users/views.py
37
85.98
0.0% api/v1/v1_data/views.py
16
90.94
3.44% api/v1/v1_profile/views.py
15
92.97
0.17% api/v1/v1_profile/serializers.py
11
78.87
-0.54% utils/draft_model.py
8
95.58
0.0% api/v1/v1_mobile/views.py
8
89.53
1.48% api/v1/v1_users/models.py
7
93.67
0.0% api/v1/v1_visualization/views.py
6
95.26
0.09% api/v1/v1_data/models.py
6
96.2
0.2% api/v1/v1_forms/models.py
5
96.5
0.0% api/v1/v1_jobs/administrations_bulk_upload.py
5
93.24
0.29% utils/soft_deletes_model.py
4
92.42
0.42% api/v1/v1_profile/management/commands/administration_seeder.py
3
98.67
0.16% api/v1/v1_profile/models.py
2
96.36
0.14% api/v1/v1_mobile/models.py
2
94.53
1.0% utils/custom_generator.py
1
95.0
-0.83% api/v1/v1_data/management/commands/generate_config.py
1
95.83
0.6% api/v1/v1_jobs/models.py
1
95.45
-2.27% api/v1/v1_users/management/commands/fake_user_seeder.py
1
98.43
0.11% utils/custom_serializer_fields.py
Jobs
ID Job ID Ran Files Coverage
1 #773.1 30 Jul 2026 07:14AM UTC 113
88.79
Source Files on build #773
  • Tree
  • List 113
  • Changed 25
  • Source Changed 0
  • Coverage Changed 25
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • Pull Request #280
  • PR Base - main (#)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc