Commit Graph

36 Commits

Author SHA1 Message Date
4b930ba1b2 feat(membership): add membership_status, resignation_date, fee_included_in_parent
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- New columns on companies: membership_status (active/resigned/suspended/exempt),
  resignation_date, fee_included_in_parent (boolean)
- Migration 094: sets KORNIX as resigned, PZU resignation_date=2026-03-02,
  links subsidiaries (Pelmar→P&P, Chopin TV→TTM), adds missing companies
  (Maciej Hałas, Markisol as resigned; Fresh Bike, Jantar, WW Glass as
  active subsidiaries)
- Admin fees panel and board view now exclude fee_included_in_parent companies
- Added source Excel file: data/skladki_czlonkowskie_2022_2025.xlsx

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 11:11:56 +02:00
20c8530934 feat(admin): kolumna blokady konta w panelu użytkowników
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Dodano kolumnę "Blokada" w /admin/users pokazującą:
- status blokady z pozostałym czasem w minutach
- liczbę nieudanych prób logowania
- przycisk "Odblokuj" do natychmiastowego odblokowania konta
- filtr "Zablokowane" w zakładkach

Nowy endpoint POST /admin/users/<id>/unlock dla adminów.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 10:27:14 +01:00
3736065dda feat(fees): kolumna zaległości z lat poprzednich z edycją inline
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Dodano pole previous_years_debt w modelu Company. Kolumna widoczna w widoku
rocznym składek — kliknięcie kwoty otwiera pole edycji. Legenda zaktualizowana.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 15:11:34 +01:00
cdbd89a792 fix(fees): uproszczone filtry składek — 3 jasne kategorie
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Zamiast mylących "mają nieopłacone" vs "częściowo opłacone":
- Opłacone za cały rok
- Częściowo opłacone (mix opłaconych/nieopłaconych + niepełne wpłaty)
- Brak wpłat (żaden miesiąc nie opłacony)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 14:57:48 +01:00
1645ed49f4 fix(fees): search reminder messages across all company users, not just first
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:51:33 +01:00
069280870f feat(fees): reminder status column — sent/read tracking
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
New "Przypomnienie" column in yearly fee view shows:
- Empty: no reminder sent yet → button "Przypomnij"
- "✉ Wysłano 20.03": sent but not read → button "Ponów"
- "✓ Odczytano 20.03": sent and read → button "Ponów"
Status derived from last PrivateMessage with "przypomnienie o składce".

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:48:52 +01:00
49fcdbdfb5 improve(fees): multi-email support in payment reminders
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Checkboxes for each available email (company, contacts, users)
- Multiple emails can be selected simultaneously
- Additional manual email input field
- Backend sends to all selected addresses in one email

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:44:17 +01:00
496a651c45 improve(fees): selectable recipient and email in payment reminder
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Portal recipient: dropdown with all users linked to company + role
- Email: dropdown with company email, contacts, user emails
- Editable email field for manual override
- Roles shown: Właściciel, Zarządzający, Pracownik

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:40:46 +01:00
ce92155836 improve(fees): detailed per-month breakdown in payment reminder
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Instead of "9 mies. × 200 zł", shows line-by-line breakdown:
- marzec: 50 zł (składka 200 zł, wpłacono 150 zł)
- kwiecień: 200 zł
- maj: 200 zł
...

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 08:36:27 +01:00
8d4c4333cf feat(fees): payment reminder with preview — portal message + email
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Admin can click "Przypomnij" next to any company with unpaid fees.
Opens modal with full message preview including:
- Amount due and period
- Bank account details (KBS Wejherowo)
- Auto-generated transfer title
Admin reviews the message before sending. Sends as portal private
message + optional email to company contact.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 22:09:54 +01:00
2407ce25b4 improve(fees): separate companies with/without fee data
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Companies with fee records shown first, then a separator row
"Firmy bez danych o składkach", then companies without data
shown in muted style.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:51:14 +01:00
345fc175eb improve(fees): show rate badge for higher membership fees (300 zł)
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Companies with monthly rate above standard 200 PLN get a small blue
badge next to their name showing the actual rate (e.g. "300 zł").

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 21:15:30 +01:00
ccd8e5c052 improve(fees): smaller stats, no decimals, yearly status filter
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Stat cards: smaller font and padding
- Amounts displayed as whole PLN (no decimals)
- Status filter works in yearly view: "Uregulowane cały rok",
  "Oczekujące", "Częściowo opłacone"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:47:34 +01:00
f6ce83372b improve(fees): auto-submit filters, extend year range to 2022
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Filter selects now auto-submit on change (no "Filtruj" button needed).
Year range extended from 2022 to current+1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 20:45:42 +01:00
bcc33fecc9 fix(calendar): use external_source as organizer for external events
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
ICS export, RSS feed, and admin creation now correctly use
external_source (e.g. "Agencja Rozwoju Pomorza") as the organizer
instead of defaulting to "Norda Biznes" for external events.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 10:56:35 +01:00
7a3955d0fa feat(calendar): add external events support for KIG/ARP integration
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
External events from partner organizations (ARP, KIG, etc.) can now
be added to the calendar with distinct visual treatment:
- Grey badge "ZEWNĘTRZNE" and muted date box in list view
- Grey color in grid view with border accent
- "Jestem zainteresowany" instead of "Zapisz się" (no commitment)
- Prominent "Przejdź do rejestracji" button linking to external organizer
- "Zainteresowani" section instead of "Uczestnicy"
- Toggle filter "Pokaż zewnętrzne" with localStorage persistence
- Admin form checkbox to mark events as external

New fields: is_external, external_url, external_source on NordaEvent.
Migration: 086_external_events.sql

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 10:23:10 +01:00
327cb5a790 feat(calendar): add attachment support to events
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Adds file attachment capability to NordaEvent model (attachment_filename,
attachment_path columns). Admin can upload PDF/DOCX when creating events.
Users see a download link on the event detail page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 17:22:18 +01:00
8f37ef4ded feat: distinguish admin-initiated password reset emails
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Admin-sent reset emails now say "Administrator portalu wygenerował
link do ustawienia hasła" instead of generic "zażądano resetowania".
Validity period shown correctly: 24h for admin, 1h for self-service.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:08:41 +01:00
0214cc70f2 fix: password reset token used utcnow vs now, extend admin reset to 24h
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
The admin reset-password endpoint used datetime.utcnow() while the
validation used datetime.now(), causing tokens to appear expired
immediately on CET servers. Changed to datetime.now() and extended
admin-initiated resets to 24 hours validity.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:07:17 +01:00
1522ce344c feat: add 'send reset email' button to admin user password modal
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Admin can now send a password reset email directly from /admin/users
instead of manually copying and sharing the reset link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 11:01:26 +01:00
b0a8971980 feat: auto-sync is_norda_member flag when linking/unlinking companies
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Set is_norda_member=True when admin assigns active company to user
- Clear is_norda_member=False when last active company is removed
- Covers admin edit route and admin API add/remove company routes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 14:55:49 +01:00
29ce843849 feat: New users get NONE company role, admin alert for pending approvals
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Registration now assigns company_role=NONE instead of VIEWER - users
with a company NIP must be approved by admin/office manager before
getting any company dashboard access. Admin panel shows yellow alert
banner and "Oczekujący" filter tab when users are pending approval.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 12:52:22 +01:00
9a91fe3224 fix: sync user↔company in user_companies + fix calendar field names
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Migration 065: backfill user_companies from legacy User.company_id
- Auth register: create UserCompany record on registration
- Admin assign company: sync user_companies when assigning via admin panel
- Fix NordaEvent field names: start_time→time_start, end_time→time_end,
  max_participants→max_attendees, remove non-existent fields

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 16:06:49 +01:00
650e2a983c feat(admin): Add direct password setting, instant tooltips, and last login column
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Admin can now set passwords directly via modal with generator (crypto.getRandomValues),
replacing the confirm-dialog flow with a tabbed modal (set password / reset link).
Custom CSS tooltips replace native title="" for instant hover display.
New "Ostatnie logowanie" column shows last_login timestamps.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-09 12:55:22 +01:00
aa49c18f7a feat(admin): Add user-company assignment UI from companies panel
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add "Users" button and modal in companies table to view/assign/unassign users
- New endpoint POST /admin/companies/<id>/unassign-user to detach user from company
- New endpoint GET /admin/users/list-all for user dropdown in assignment modal
- Modal shows assigned users with "Unpin" button and dropdown for adding new ones

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 17:17:54 +01:00
e718d96a7d fix(security): Resolve 1 HIGH and 7 MEDIUM vulnerabilities from code review
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- HIGH: Fix SQL injection in ZOPK knowledge service (3 functions) — replace f-strings with parameterized queries
- MEDIUM: Sanitize tsquery/LIKE input in SearchService to prevent injection
- MEDIUM: Add @login_required + @role_required(ADMIN) to /health/full endpoint
- MEDIUM: Add @role_required(ADMIN) to ZOPK knowledge search API
- MEDIUM: Add bleach HTML sanitization on write for announcements, events, board proceedings (stored XSS via |safe)
- MEDIUM: Remove partial API key from Gemini service logs
- MEDIUM: Remove @csrf.exempt from chat endpoints, add X-CSRFToken headers in JS
- MEDIUM: Add missing CSRF tokens to 3 POST forms (data_request, benefits_form, benefits_list)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-06 05:25:18 +01:00
f2fc1b89ec refactor(rbac): Complete RBAC migration - 154/154 admin routes protected
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add @role_required to 2 missing routes (krs_api PDF download, zopk milestones)
- Add role-based menu visibility in admin bar (hide Users, Security, Benefits,
  Model Comparison, Debug from OFFICE_MANAGER users)
- Inject SystemRole into Jinja2 context processor for template role checks
- Replace is_admin checkbox with role select dropdown in user creation form
- Migrate routes.py and routes_users_api.py from is_admin to SystemRole-based
  role assignment via set_role()
- Add deprecation notice to is_admin database column
- Add 23 RBAC unit tests (hierarchy, has_role, set_role, permissions)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 21:36:14 +01:00
c0d60481f0 refactor(rbac): Migrate legacy is_admin checks to role-based has_role()/set_role()
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Replace ~20 remaining is_admin references across backend, templates and scripts
with proper SystemRole checks. Column is_admin stays as deprecated (synced by
set_role()) until DB migration removes it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-05 21:06:22 +01:00
932ee9c2b0 fix(admin): Use raw SQL DELETE to bypass ORM backref cascades
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Expunge user from ORM session and use raw SQL DELETE to prevent
SQLAlchemy from trying to SET NULL on backref relationships.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:41:06 +01:00
11ee9d8493 fix(admin): Handle dependent records when deleting users
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Clean up FK references with NO ACTION before user deletion:
- SET NULL for nullable FK columns (30+ tables)
- DELETE records for NOT NULL FK columns without CASCADE
Prevents IntegrityError on user_notifications and other tables.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:39:37 +01:00
650c0d5760 feat: Add Strefa RADA - closed section for Board Council members
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add @rada_member_required decorator for access control
- Add BoardDocument model for storing protocols and documents
- Create document upload service (PDF, DOCX, DOC up to 50MB)
- Add /rada/ blueprint with list, upload, download endpoints
- Add "Rada" link in navigation (visible only for board members)
- Add "Rada" badge and toggle button in admin user management
- Create SQL migration to set up board_documents table and assign
  is_rada_member=True to 16 board members by email

Storage: /data/board-docs/ (outside webroot for security)
Access: is_rada_member=True OR role >= OFFICE_MANAGER

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 18:41:12 +01:00
61345fa260 feat: Add event access control for Rada Izby meetings
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
- Add access_level field to norda_events (public, members_only, rada_only)
- Add is_rada_member field to users table
- Add can_user_view() and can_user_attend() methods to NordaEvent model
- Update calendar routes to filter events by user permissions
- Add access_level dropdown to admin event form
- Rada Izby events only visible to designated board members
- Regular member meetings visible to all NORDA members

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-03 12:41:42 +01:00
4181a2e760 refactor: Migrate access control from is_admin to role-based system
Replace ~170 manual `if not current_user.is_admin` checks with:
- @role_required(SystemRole.ADMIN) for user management, security, ZOPK
- @role_required(SystemRole.OFFICE_MANAGER) for content management
- current_user.can_access_admin_panel() for admin UI access
- current_user.can_moderate_forum() for forum moderation
- current_user.can_edit_company(id) for company permissions

Add @office_manager_required decorator shortcut.
Add SQL migration to sync existing users' role field.

Role hierarchy: UNAFFILIATED(10) < MEMBER(20) < EMPLOYEE(30) < MANAGER(40) < OFFICE_MANAGER(50) < ADMIN(100)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-01 21:05:22 +01:00
49830855a2 refactor: Migrate ZOPK and Users API routes to admin blueprint
Major refactoring to reduce app.py size by ~22%:
- Move all ZOPK routes (47 endpoints) to 4 blueprint files:
  - routes_zopk_dashboard.py - main dashboard
  - routes_zopk_news.py - news management, scraping, AI evaluation
  - routes_zopk_knowledge.py - knowledge base, embeddings, graph
  - routes_zopk_timeline.py - milestones management
- Move Users API routes to routes_users_api.py:
  - /admin/users-api/ai-parse - AI-powered user parsing
  - /admin/users-api/bulk-create - bulk user creation
- Move notify-release to routes.py

app.py reduced from 11518 to 8916 lines (-22.6%)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 17:05:36 +01:00
ba0baf1305 fix: Correct template paths for admin calendar
- calendar/admin.html (not admin/calendar.html)
- calendar/admin_new.html (not admin/calendar_form.html)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:12:15 +01:00
44268c5425 refactor: Extract admin blueprint Part 1 (Phase 6)
Moved 19 admin routes to blueprints/admin/:
- Recommendations: 3 routes (list, approve, reject)
- Users: 8 routes (list, add, toggle-admin, toggle-verified, update, assign-company, delete, reset-password)
- Fees: 5 routes (list, generate, mark-paid, bulk-mark-paid, export)
- Calendar admin: 3 routes (list, new, delete)

Note: AI-parse routes (/api/admin/users/ai-parse, ai-create) remain in app.py.

Aliases created for backward compatibility.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 08:05:06 +01:00