AC:
- Non-staff users can create tasks and assign them to themselves by default.
- Non-staff users in case granted the
assign_tasks_to_others permission can assign tasks to other non-staff users.
- Non-staff users cannot assign tasks to staff users.
- Staff users (Django's
is_staff) can assign tasks to any user.
- Users can view tasks they created or tasks assigned to them.
- Users with
view_other_users_tasks permission can view all tasks.
- Task list can be filtered by user's relationship to the task ("assigned to me" / "created by me").
Implementation details
Model Changes:
- Add
created_by FK field to Task model (existing tasks default to created_by = user)
- Add new permission:
assign_tasks_to_others
Endpoint changes:
| Endpoint |
Change |
POST /badgerdoc/task/ |
user field (assignee) is now optional; defaults to current user |
GET /badgerdoc/tasks/ |
New filter params: created_by_id, my_role (assigned | created) |
GET /badgerdoc/task/{id}/details/ |
Response includes new fields: created_by (username), assigned_to (username) |
Updated Task Response Schema
created_by: string // creator username
assigned_to: string // assignee username
user: number // assignee ID (existing)
Access control:
- Non-staff users: results scoped to
created_by = current_user OR user = current_user
- Staff /
view_other_users_tasks: no restriction
AC:
assign_tasks_to_otherspermission can assign tasks to other non-staff users.is_staff) can assign tasks to any user.view_other_users_taskspermission can view all tasks.Implementation details
Model Changes:
created_byFK field toTaskmodel (existing tasks default tocreated_by = user)assign_tasks_to_othersEndpoint changes:
POST /badgerdoc/task/userfield (assignee) is now optional; defaults to current userGET /badgerdoc/tasks/created_by_id,my_role(assigned|created)GET /badgerdoc/task/{id}/details/created_by(username),assigned_to(username)Updated Task Response Schema
Access control:
created_by = current_user OR user = current_userview_other_users_tasks: no restriction