31 Commits

Author SHA1 Message Date
4f6244ab1f Fix CORP runtime errors and harden deployment and media access
Some checks failed
Deploy production / deploy (push) Failing after 2s
2026-09-10 16:40:08 +03:00
lizerk
dac0234007 Enforce repository-wide code quality 2026-09-07 19:43:48 +03:00
lizerk
d6706c518b Support multiple employee positions 2026-08-27 10:41:50 +03:00
lizerk
b6a6b8210e Add position creation to user modal and secret skill admin tools 2026-08-27 09:12:47 +03:00
lizerk
c0185913e6 Centralize secret skill calculation start date 2026-08-26 16:52:50 +03:00
lizerk
51b15aa650 feat: add secret skills leaderboard report 2026-08-26 15:45:31 +03:00
lizerk
154871d693 fix: serialize empty secret skill periods 2026-08-26 15:31:27 +03:00
lizerk
fede6882a2 feat: recalculate secret skills from date 2026-08-26 15:23:48 +03:00
lizerk
65c51b64e3 feat: add task execution secret skill 2026-08-26 11:20:06 +03:00
lizerk
d36996b4e3 fix: treat remote work as employment activation 2026-08-26 10:20:17 +03:00
lizerk
5c896ad589 fix: derive personnel skills from employee actions 2026-08-26 10:03:42 +03:00
lizerk
912b0da773 feat: add reliability and resilience secret skills 2026-08-26 09:50:55 +03:00
lizerk
9d16efadec feat: add secret skill anti-streaks 2026-08-26 09:21:34 +03:00
lizerk
2e807d83dd feat: add attendance secret skills 2026-08-26 08:50:00 +03:00
lizerk
f3d2d2fe44 Hide excluded employees from UI-facing APIs and payroll workflows 2026-08-25 10:55:38 +03:00
lizerk
8fd5ae1054 feat: expand document procurement and request workflows 2026-08-04 20:19:12 +03:00
lizerk
df2377431d feat: expand documents tasks and procurement workflows 2026-07-17 14:09:06 +03:00
lizerk
786987efe5 Stabilize Celery background jobs 2026-07-16 13:59:50 +03:00
lizerk
01490aa20b Improve employee stats and task card text 2026-07-12 21:22:55 +03:00
lizerk
32500e3037 chore: checkpoint current project changes 2026-06-20 10:47:00 +03:00
lizerk
92fb845b70 Fix birthday event sync lifecycle 2026-05-14 16:32:27 +03:00
lizerk
3a20c3d86a Normalize personnel events and attendance state 2026-04-29 09:54:11 +03:00
lizerk
78b8615871 feat: refine department calendar behavior and UI 2026-04-16 17:22:06 +03:00
lizerk
5700b53f13 feat: add department calendar bindings and cleanup dept permissions 2026-04-16 15:18:43 +03:00
lizerk
8d22156b36 feat(admin): add department role ldap sync action 2026-04-14 01:49:30 +03:00
lizerk
21db7f61a2 test(ldap): expand department role sync coverage 2026-04-14 01:33:24 +03:00
lizerk
2d00699831 fix(ldap): nest department role groups into department group 2026-04-14 01:07:13 +03:00
lizerk
81b8d29b38 Refactor department LDAP sync around canonical service flows 2026-04-10 20:54:09 +03:00
lizerk
f15e8aca3f feat(ldap): add LDAP sync retry queue with Celery
- Add LdapSyncQueue model for deferred LDAP operations
- Add Celery tasks: process_ldap_queue_item, process_ldap_queue
- Refactor all LDAP signals (employee, department, group, position)
  to enqueue operations on DirectoryLdapError/DirectoryServiceError
- Add _queue.py helper for enqueuing with automatic Celery dispatch
- Add Celery Beat periodic task (every 60s) for queue processing
- Add management command: ldap_queue (status/retry/cleanup)
- Add migration 0043_ldap_sync_queue
- Add 18 tests covering model, tasks, signals, and enqueue logic
- Include LDAP services refactoring (base_service, constants,
  user_login_service, user_mapper_service, user_password_service,
  phone_utils)
2026-03-19 15:07:34 +03:00
81cdf7fb24 fix: add is_active check to PositionRoleBackend and fix tests
Changes:
1. auth_backends.py - Added is_active check in get_all_permissions()
   Inactive users should not receive any permissions from their position

2. test_position_permissions.py - Multiple test fixes:
   - Moved fixtures to module level (accessible to all test classes)
   - Changed Permission creation to filter().first() pattern (no IntegrityError)
   - Fixed permission cache issues (use fresh User.objects.get() after changes)
   - Changed test_staff_user_keeps_all_permissions → test_superuser_has_all_permissions
     (is_staff does NOT grant all perms, only is_superuser does)

Test Results:
✅ 13/13 tests PASSED
✅ All permission inheritance scenarios verified
✅ PositionRoleBackend implementation confirmed working

Key Findings:
- Position → Groups → Permissions inheritance works correctly
- Permission caching requires fresh instance after position changes
- is_active check was missing (now fixed)
- is_staff does NOT grant all permissions (only is_superuser)

Next Steps:
- Check production environment for permission caching issues
- Verify LDAP group sync is working
- Test UI button visibility with real user accounts
2025-12-08 14:02:09 +03:00
b9e24dd841 test: add comprehensive position permissions tests
Created pytest test suite to verify permission inheritance through positions:

Test Coverage:
1. User without position has no permissions (PASS)
2. User with position gets all group permissions (needs fix)
3. Position change updates permissions dynamically
4. Remove position removes all permissions
5. Multiple users with same position get same permissions
6. Staff users keep all permissions regardless
7. Multiple groups' permissions are additive
8. get_all_permissions() includes position perms
9. Position without groups grants no permissions (PASS)
10. Inactive users have no permissions
11. Direct user permissions + position permissions combine
12. Feed/Documents integration tests

Current Results:
- 3 tests PASSED (basic cases)
- 10 tests need fixing (fixture scope issues)

Purpose:
These tests will validate that PositionRoleBackend correctly
grants permissions from Position.groups to users, which is
needed for features like:
- Show 'Create Post' button for users with publishing rights
- Show 'Create Document' button for users with document rights
- Consistent permission checks across frontend and backend

Next Steps:
1. Fix IntegrityError in permission creation (use filter first)
2. Make fixtures work across test classes
3. Run tests to verify PositionRoleBackend implementation
4. If tests fail, fix the backend implementation
2025-12-08 13:54:28 +03:00