-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
Phase 3 Overview
Build API endpoints for role management with temporal parameters and implement authorization policies.
Tasks
- Create API endpoints for role management
POST /api/v1/users/{id}/roles- Assign role with temporal paramsGET /api/v1/users/{id}/roles- List roles with expiry infoDELETE /api/v1/users/{id}/roles/{role}- Revoke rolePATCH /api/v1/users/{id}/roles/{role}/extend- Extend expiration
- Create
RoleControllerwith request validation- Validate
valid_from < valid_until - Validate user has permission to assign role
- Validate temporal constraints (max duration, etc.)
- Validate
- Create form requests
AssignRoleRequest- validate temporal parametersExtendRoleRequest- validate extension limits
- Implement authorization policies
EmployeePolicy- who can view/edit employeesShiftPlanPolicy- who can create/approve plansRolePolicy- who can assign/revoke roles
- Apply middleware to API routes
auth:sanctumfor authenticationpermission:middleware for authorization
- Write feature tests for all endpoints
- Role assignment with temporal params
- Role listing with expiry dates
- Role extension authorization
- Policy enforcement validation
Acceptance Criteria
- All API endpoints implemented and documented
- Request validation prevents invalid temporal assignments
- Authorization policies enforce RBAC rules
- Middleware applied to all protected routes
- Feature tests achieve >80% coverage
- API documentation updated in OpenAPI spec
- Postman collection updated with examples
API Examples
Assign Temporary Role:
POST /api/v1/users/123/roles
{
"role": "manager",
"valid_from": "2025-12-01T00:00:00Z",
"valid_until": "2025-12-14T23:59:59Z",
"auto_revoke": true,
"reason": "Vacation coverage for Manager A"
}Extend Role Expiration:
PATCH /api/v1/users/123/roles/manager/extend
{
"valid_until": "2025-12-21T23:59:59Z",
"reason": "Extended vacation period"
}Reference
- ADR-004: RBAC Architecture Decision
- Parent Issue: 🔐 Implement RBAC System (Role-Based Access Control) #5 (RBAC System)
- Depends on: Phase 1 ✅, Phase 2
Estimated Time
- Estimate: 2 days
- Actual: TBD
Metadata
Metadata
Assignees
Type
Projects
Status
✅ Done