Employee Management
The Employee entity (src/Entity/Organization/Employee) is Doggy's user model and also the Symfony Security authentication subject. It is managed via EmployeeController and EmployeeApiController.
Overview
Employee management covers the full lifecycle from multiple perspectives:
- HR View: Roster management, onboarding, statistics
- IT View: Account provisioning, permission assignment, Passkey setup
- Manager View: Team management, reporting structure, personnel assignments
Entity Structure
Employee is App\Entity\Organization\Employee and serves as the Security user provider:
yaml
# config/packages/security.yaml
providers:
app_user_provider:
entity:
class: App\Entity\Organization\EmployeeKey fields:
isPasswordModifiedByUser: Whether the initial password has been changed- One-to-many relationship with
WebauthnCredential(passkeys) - Avatar managed via
AvatarController
Core Features
Employee Roster
- List:
templates/employee/list.html.twig - Detail:
templates/employee/show.html.twig - Edit:
templates/employee/edit.html.twig,edit_drawer.html.twig - Avatar:
templates/employee/_avatar_modal.html.twig
API Endpoints
http
GET /api/admin/employees # Employee list
POST /api/admin/employees # Create employee
GET /api/admin/employees/{id} # Employee detail
PUT /api/admin/employees/{id} # Update employee
DELETE /api/admin/employees/{id} # Delete employeeOnboarding Flow
On first login, UserSetupListener checks user status:
- Check if password has been modified (
isPasswordModifiedByUser) - Check if Passkey has been registered
- If either step is incomplete, redirect to setup page
User Setup
php
// src/EventListener/UserSetupListener.php
// Allowed route whitelist: app_user_setup, app_logout
// WebAuthn and login routes are always accessible
// Redirects to setup page if password unchanged or no Passkey registeredAdmin Controllers
- Employee list:
App\Controller\EmployeeController - API:
App\Controller\Api\EmployeeApiController - Avatar:
App\Controller\Api\AvatarController