Skip to content

Task creation/assignment logic #1139

Description

@sem0ark

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

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions