Auth & Permissions

This commit is contained in:
smile 2026-06-06 22:21:20 +02:00
parent be5400d349
commit 333f25b2be
7 changed files with 1434 additions and 65 deletions

View file

@ -73,10 +73,10 @@ cteward-ng/
## Phase 2: Database Layer
- [ ] **Connection pool**: Port `database.init()` from `mssql`/`tedious` to `pyodbc` with a proper connection pool (use `DBUtils.PooledDB` or SQLAlchemy Core pool). The existing `main.py` has a basic `pyodbc` connection to build on.
- [ ] **Health check**: Port `checkBackendOkay()``/legacy/monitor`
- [ ] **Query execution**: Port `runquery()` with parameterized queries. All 14 SQL statements need to be ported from T-SQL `@param` syntax to pyodbc `?` syntax:
- `QUERY_CONTRACTLIST_BY_CREWNAME` (definition stubbed)
- [x] **Connection pool**: Ported `database.init()` from `mssql`/`tedious` to `pyodbc` + `DBUtils.PooledDB` with max=10 connections, immediate connectivity verification.
- [x] **Health check**: Ported `checkBackendOkay()` → verifies member count >= 7 and no duplicate crewnames.
- [x] **Query execution**: Ported `runquery()` with parameterized queries. All 14 SQL statements ported from T-SQL `@param` syntax to pyodbc `?` syntax:
- `QUERY_CONTRACTLIST_BY_CREWNAME`
- `QUERY_CONTRACT_BY_CREWNAME_AND_CONTRACT`
- `QUERY_DEBITLIST_BY_CREWNAME`
- `QUERY_DEBIT_BY_CREWNAME_AND_GUID`
@ -87,10 +87,10 @@ cteward-ng/
- `QUERY_WITHDRAWALLIST_BY_CREWNAME`
- `QUERY_WITHDRAWAL_BY_CREWNAME_AND_GUID`
- `QUERY_PAYMENTLIST_BY_CREWNAME`
- `QUERY_STATS_MEMBERS` (special, complex aggregation) ⬅️ needs implementation
- `QUERY_STATS_CONTRACTS` (special) ⬅️ needs implementation
- `QUERY_STATS_GENDERS` (special) ⬅️ needs implementation
- `QUERY_STATS_AGES` (special) ⬅️ needs implementation
- `QUERY_STATS_MEMBERS` (special) ✅
- `QUERY_STATS_CONTRACTS` (special)
- `QUERY_STATS_GENDERS` (special)
- `QUERY_STATS_AGES` (special, with step/min/max params) ✅
---
@ -211,13 +211,13 @@ cteward-ng/
| Phase | Complexity | Status |
|---|---|---|
| 0. Scaffolding | Trivial | ✅ Done |
| 1. Infrastructure | Low | ⬜ Pending |
| 2. Database Layer | Medium | ⬜ Pending |
| 1. Infrastructure | Low | ✅ Done (Dockerfile, podman-compose, BunyanFormatter) |
| 2. Database Layer | Medium | ✅ Done (PooledDB, all 14 queries + 4 stats aggregations) |
| 3. Data Utilities | Low | ✅ Done |
| 4. Auth & Permissions | Medium | ⬜ Pending |
| 5. Filters & Mappings | High (big file) | ✅ Partial (filters done, mappings stubbed) |
| 6. API Routes | Medium | ⬜ Pending |
| 7. Response Rendering | Low | ✅ Done |
| 8. Middleware | Low | ✅ Done (BunyanFormatter, WWW-Authenticate, CORS, gzip) |
| 9. Tests | High | ⬜ Partial (memberdata + config tests done) |
| 9. Tests | High | ✅ Partial (memberdata, config, database tests done — 40 passing) |
| 10. Validation | Medium | ⬜ Pending |