StaffCoder
Django
DjangoDjango 5.2Python 3.13
18 modules · 72 challengesSign up
Modules18 modules · 72 challenges
Decide who may do what: token authentication, permission classes as policy, object-level ownership, and one API whose access matrix covers anonymous, signed-in, owner and moderator alike.
Finish every challenge, or complete the star challenge, to complete the module.

Challenges

4 challenges

Token Authenticated API

Sign up to unlock
—No data yetmedium
About this challenge

Mobile clients cannot use browser sessions, so they send an email and a password with every API request. Build the token-obtain endpoint for the project's email-based user model and make token authentication the API's first scheme, with sessions still accepted.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Permission Class Policies

Sign up to unlock
—No data yetmedium
About this challenge

Every endpoint in this API is either wide open or locked to everyone, because no view and no project setting says who is allowed in. Name an authenticated-only project default, let anonymous clients read but not write the public catalog, and gate catalog writes on the model permissions the catalog editors group carries.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Object Owner Permission

Sign up to unlock
—No data yetmedium
About this challenge

Any signed-in account can rewrite or delete anybody's post through this API, and one account's private drafts turn up in every other account's draft list. Write an object-level permission that lets owners write while everybody else only reads, and scope the drafts endpoint's queryset to the account making the request.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

Shared Notes API

STAR
Solving it completes the module
—No data yetmedium
About this challenge

A notes API is read and rewritten by anybody who can reach it, because no scheme says who a caller is and no rule says what they may do. Accept both token and session authentication, let strangers read the shared record and nothing more, give each note's owner the only write, scope the private surface to its requester, and let the moderators group delete.

Read the full problem
Solved in a browser IDE and graded by tests. Sign up to solve

We use cookies that are necessary to run Staffcoder, and optional analytics cookies to see which pages get used. Analytics stays off unless you accept. Read our Cookie Policy.