Blog › Programming · Published 2026-11-26

How to build a staff task dashboard with roles and permissions

The problem

A manager needs to assign tasks, staff need to see only their own, and everything must export to CSV.

Data model

Rules

def can_view(user, task):
    if user.role in ("admin", "manager"):
        return True
    return task.assignee_id == user.id

Enforce this check on the server for every request. Hiding a button in the page is not security.

CSV export

import csv, io
buf = io.StringIO()
w = csv.writer(buf)
w.writerow(["id","title","status","due"])
for t in tasks:
    w.writerow([t.id, t.title, t.status, t.due_date])

Add filters (status, assignee, date) as query parameters and use the same permission check before building the export.

Official sources

Need help with your project?
We build websites, systems and automation. Start your project WhatsApp

All articles