Native organizations and external projects #30

Merged
Gilles merged 1 commit from feat/26-native-orgs-external-projects into master 2026-10-28 18:33:52 +00:00
Owner

Closes #26

Part of the server monitoring plan (phase 1.1): Argus can now hold reports that don't come from a Forgejo repo.

Changes

  • Organization.kind (forgejo | native) and Project.kind (forgejo | external), with migrations (existing rows default to forgejo). forgejo_owner/forgejo_repo remain the slugs, so /:owner/:repo URLs, badges and upload tokens work unchanged.
  • POST /api/organizations/ with kind=native: Argus admins only (Django superusers for now, argus-admins group in #27), slug validated, never adopts an existing organization. A Forgejo organization can't take a native slug.
  • POST /api/projects/ with kind=external: admin on the (existing) organization, slug validated. A Forgejo project can't be created in a native organization. kind is read-only afterwards.
  • New apps.accounts.access: the single place deciding access (Forgejo repo permission, Forgejo org permission for external projects of a Forgejo org, Argus admin for native orgs). Used by all views, event serializers/views, deliveries and the bigb scope. Test mocks now target apps.accounts.access.has_at_least / has_org_level.
  • Forgejo-only features skip external projects: closed-PR sweep and cleanup_pr, Forgejo webhook (202 no-op), source view (404), project discovery (empty list); uploads with ref_kind=pr are refused (400).
  • Feature catalog: new "Sources hors Forgejo" family; tests in apps/reports/test_external.py.

Checks

pytest (194 passed), pylint 10/10, autopep8, bandit clean.

Follow-ups (stacked PRs)

#27 Authentik groups → #28 sources/JSON/dedup → #29 stale trigger → #23 → #21.

🤖 Generated with Claude Code

https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA

Closes #26 Part of the server monitoring plan (phase 1.1): Argus can now hold reports that don't come from a Forgejo repo. ## Changes - `Organization.kind` (`forgejo` | `native`) and `Project.kind` (`forgejo` | `external`), with migrations (existing rows default to `forgejo`). `forgejo_owner`/`forgejo_repo` remain the slugs, so `/:owner/:repo` URLs, badges and upload tokens work unchanged. - `POST /api/organizations/` with `kind=native`: Argus admins only (Django superusers for now, `argus-admins` group in #27), slug validated, never adopts an existing organization. A Forgejo organization can't take a native slug. - `POST /api/projects/` with `kind=external`: admin on the (existing) organization, slug validated. A Forgejo project can't be created in a native organization. `kind` is read-only afterwards. - New `apps.accounts.access`: the single place deciding access (Forgejo repo permission, Forgejo org permission for external projects of a Forgejo org, Argus admin for native orgs). Used by all views, event serializers/views, deliveries and the bigb scope. Test mocks now target `apps.accounts.access.has_at_least` / `has_org_level`. - Forgejo-only features skip external projects: closed-PR sweep and `cleanup_pr`, Forgejo webhook (202 no-op), source view (404), project discovery (empty list); uploads with `ref_kind=pr` are refused (400). - Feature catalog: new "Sources hors Forgejo" family; tests in `apps/reports/test_external.py`. ## Checks pytest (194 passed), pylint 10/10, autopep8, bandit clean. ## Follow-ups (stacked PRs) #27 Authentik groups → #28 sources/JSON/dedup → #29 stale trigger → #23 → #21. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
feature: native organizations and external projects
All checks were successful
ci / test (pull_request) Successful in 3m23s
ci / e2e (pull_request) Has been skipped
ci / docker (pull_request) Has been skipped
ci / deploy (pull_request) Has been skipped
192fff600d
Reports can now come from outside Forgejo (servers, uptime checks,
metrics collectors):

- Organization.kind (forgejo|native) and Project.kind
  (forgejo|external); forgejo_owner/forgejo_repo stay the slugs, so
  URLs, badges and tokens are unchanged.
- A native organization is created by an Argus admin (superuser for
  now); an external project needs admin on its organization. A Forgejo
  project can't live in a native organization.
- Access resolution moves into apps.accounts.access, used by every
  view, the event serializers, deliveries and the bigb scope.
- Forgejo-only features skip external projects: PR sweep, webhook,
  source view, discovery; PR uploads are refused for them.

Closes #26

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014BSmBtGWeFBD9z4mYm9SjA
Author
Owner
<!-- argus-link-bot:argus/backend --> 📊 [Rapports Argus pour cette PR](https://reports.stationmyr.net/argus/backend/pr/30)
Gilles merged commit 442151067d into master 2026-10-28 18:33:52 +00:00
Gilles deleted branch feat/26-native-orgs-external-projects 2026-10-28 18:33:53 +00:00
Gilles referenced this pull request from a commit 2026-10-28 19:03:52 +00:00
Sign in to join this conversation.
No description provided.