Hello,
I am working on a web application which has registered users and I am trying to understand whether I need to use the permissions feature, and if so then how to use it properly.
Let’s take a website line Linktree: users can sign up and create a page which lists links. So there is some User
model, some Tree
model and some Entry
model. Entries belong to a tree, a tree belongs to a user. A user can have multiple trees. A user (let’s call her Alice) signs up, logs in, gets to her profile page, adjusts a couple of settings and a page is generated. Another user (let’s call him Bob) can view Alice’s page under let’s say /tree/k24j2lk4j/
(because it is public, no login required), but he cannot edit it. If he tries to open the URL (/user/profile/
) he will see his own profile, not Alice’s.
To my understanding all authorization happens via authentication. Bob must not be able to edit Alice’s profile page, but the view only lets him edit he own page anyway. Would there be a way for Bob to somehow manipulate Django into altering the Tree
or Entry
instances or database tables which belong to Alice by feeding a particular URL into the browser?
My web application uses a custom User
class that inherits AbstractBaseUser
. The only real difference is that my class uses the email address for identification and has no user name. I was following the Customizing authentication in Django guide and the example implementation simply gives full blanket permissions to every user. I must be missing something here because I don’t see what purpose the permission system serves.