Mark
Mark

Reputation: 2542

Django Admin Individual Access

I have a phonebook application - an internal app in our org.

I am investigating whether its possible to allow employees update their own record.

Does djangos auth system allow access to only your own details.

IE - if i looked up Active Directory for their username, and it corresponds to the username I have - then let them edit.

Upvotes: 0

Views: 65

Answers (1)

scytale
scytale

Reputation: 12641

This is not supported directly in the admin interface.

If you're talking about editing django.contrib.auth.models.User then I'd recommend just using a regular view instead of the admin interface. You may be able to inject custom validation to check that the request.user == user but it's hacky.

If you're talking about editing a UserProfile object then it's easier to add custom validation to the admin form to check for authorization.

Upvotes: 1

Related Questions