[FEATURE]: System Actor Mode for Systemic Flows #348
Labels
No labels
bug
duplicate
enhancement
help wanted
high priority
invalid
L
low priority
M
medium priority
needs refinement
optional
question
S
UX research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: local-it/mitgliederverwaltung#348
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Currently,
actoris consistently passed through all operations (cycle generation, email sync, email validation). This is correct for "user actions should respect policies" but conflicts with the goal: some validations/syncs should always run.The current implementation creates a conflict:
Solution: Two Execution Modes
A) User Mode (Policies Strict, Actor Used)
B) System Mode (Policies Bypassed / System Actor)
Implementation: Introduce System Actor
Create a dedicated system actor (e.g., service user "system@..." or admin role used only internally) that is used in:
Instead of using the user actor, use the system actor for these operations.
Affected Areas
1. Email Sync
Current State:
actoris extracted from changeset context and passed to LoaderRequired Change: Execute Email-Sync Loader systemically (using system actor) so it doesn't depend on user read permissions
Affected Files:
lib/mv/email_sync/loader.ex- All loader functions use actorlib/mv/email_sync/changes/sync_user_email_to_member.ex- Extracts actor from contextlib/mv/email_sync/changes/sync_member_email_to_user.ex- Uses actor from contextlib/membership/member.ex- Email sync changes configured in actionslib/accounts/user.ex- Email sync changes configured in actions2. Email Validation
Current State: Validations extract actor from changeset context for authorization
Required Change: Use system actor for email uniqueness checks so they always run regardless of user permissions
Affected Files:
lib/mv/membership/member/validations/email_not_used_by_other_user.ex- Uses actor for User querieslib/mv/accounts/user/validations/email_not_used_by_other_member.ex- Uses actor for Member querieslib/membership/member.ex- Validation configured in validations block (line 393)lib/accounts/user.ex- Validation configured in validations block3. Cycle Generation
Current State:
actoris passed through to cycle generationRequired Change: Decide if cycle generation is mandatory. If yes, execute systemically (using system actor)
Affected Files:
lib/mv/membership_fees/cycle_generator.ex- All functions accept actor parameterlib/membership/member.ex-handle_cycle_generationpasses actor (lines 949-992)lib/mv/membership_fees/cycle_generation_job.ex- Job execution (currently no actor passed)4. Other Changes/Validations Using Actor
Affected Files:
lib/membership/member.ex- User linking validation uses actor (lines 400-432)lib/membership_fees/changes/validate_same_interval.ex- Currently doesn't use actor (but may need system actor for type loading)Decision Points
Email Sync: Should it always run (system mode) or be blocked if user lacks permissions?
Cycle Generation: Is it mandatory or optional?
Email Uniqueness Validation: Should it always run?
Implementation Steps
Alternative: Early Blocking
If email sync should be blocked when user lacks permissions:
Acceptance Criteria
System Actor
Email Sync (System Mode)
Email Validation (System Mode)
Cycle Generation (System Mode - if mandatory)
User Actions (User Mode)
Integration