Hello,

Could you explain a few things? A node is the superclass of organization, person and thing? Could you give an example of an organization and of a thing that can or create an article? What would be a better name for test_func? Could it be named is_authorized for example? What does get_object do? What is an "object"? What would be a better name for "UserPassesTestMixin"? Maybe "UserIsAuthorized"?

Regards,

Antonis

Antonis Christofides
+30-6979924665 (mobile)


On 22/03/2022 14.49, 'AnneVerm' via Django users wrote:
I'm working on a web aplication in which I have a supertype node which is subtyped by organization, person and thing. Nodes can have permission to create/update/delete addresses, events, articles, pages etc. which all have a foreignkey referencing node.

I'm struggling with the authentication and authorization. If I add a node to the user I could use UserPassesTestMixin like this:

def test_func(self):
    obj = self.get_object()
    return obj.node == self.request.node

However, the consequence is that every node is related to a user one-to-one, which in case of things is not ideal.

I hope someone could point me in the right direction to solve this problem.

Kind regards,

Anne
--
You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/03685bda-5257-42e0-88ef-1973de3411dfn%40googlegroups.com <https://groups.google.com/d/msgid/django-users/03685bda-5257-42e0-88ef-1973de3411dfn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/4da06770-1478-6cbe-379a-9f268b85582b%40antonischristofides.com.

Reply via email to