# Authentication and authorization concepts

**URL:** <https://forum.djangoproject.com/t/authentication-and-authorization-concepts/31619>\
**Category:** Forms & APIs\
**Created:** [May 29, 2024, 7:50pm UTC](https://forum.djangoproject.com/t/authentication-and-authorization-concepts/31619 "2024-05-29T19:50:33Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 30, 2024, 3:44am UTC](https://forum.djangoproject.com/t/authentication-and-authorization-concepts/31619/2 "2024-05-30T03:44:17Z")

</div>

> [@pcampos119104](#):
>
> However, the owner can invite another user, like a nutritionist, to edit his recipes. how exactly would the best approach?

One solution for this would be to create a group for each owner. The owner would then be given the ability to add users to their group.

Side note: Materially, this is almost exactly the same as the `editors` pattern that you describe as looking strange to you. However, it’s not strange.

Beyond that, what you’re actually talking about here is a row-level security model. Yes, the Django auth system can be used as the basis for that. However, it’s not a solution that’s built-in.

For some conversations along those lines, see the threads at:

- [Custom Django Group or other solution](https://forum.djangoproject.com/t/custom-django-group-or-other-solution/30110)
- [Give permissions to users per company](https://forum.djangoproject.com/t/give-permissions-to-users-per-company/12651)

> [@pcampos119104](#):
>
> Is there a way to use the django.contrib.auth for this? Like User, Group, and Permission.

I’ll assume you’re clear on what a `User` is.

In Django terms, a `Permission` is just a name. They are typically used by Django, in views, to determine whether a user is allowed to perform some action. There’s really nothing special about them. They’re not any kind of active component. You could almost think of them as a type of “token” that a user either has or doesn’t have. This “token” doesn’t do anything, but different components can check to see if a user has it.

The best use of a Django `Group` is to think of them as “roles” in a traditional “role-based” security architecture. On one hand, they’re related to some number of permissions. On the other hand, they’re related to some number of users. So what they really do for you is allow the assignment of multiple permissions to multiple users in a consistent way.

_This_ actually isn’t that deep of a subject. These components aren’t that sophisticated, there’s just not a lot of “there” there. As a result of this, while you can use these to build a row-level security system, there’s a lot that you would need to build yourself. How you do this is going to depend upon your precise requirements. (Or, find a suitable package on [djangopackages.org](http://djangopackages.org) to help.)

---

_[View the full topic](https://forum.djangoproject.com/t/authentication-and-authorization-concepts/31619)._
