On Mar 17, 2017 1:53 AM, "guettli" <guettli.goo...@thomas-guettler.de>
wrote:

It's not a problem. It something else. I am missing the right words ... I
know how to use conditions in python or the equivalent sql operations.

I am sure that my code would be simpler if the superuser would not have all
permissions.


If you're coding your own authorization system, then the idea of a
superuser doesn't need to exist.

If you are using Django's built-in authorization system, the same rule
effectively applies if you don't assign any user the superuser attribute.



I am sure if I want to go this way, since django does it different.


Authentication and authorization are difficult topics to tackle. I'd
suggest looking at other Django packages that deal with these topics, each
with their own philosophy (possibly matching what you are looking for), and
most of which are maintained and battle tested on real sites.

https://djangopackages.org/grids/g/authentication/
https://djangopackages.org/grids/g/authorization/

Learning the built-in system or using one of these packages will likely be
easier and yield better results in the long run.


It's not a problem. Maybe it is event not a thought of my brain. It is more
a feeling or big dream: simpler code with less conditions.


That's a great goal, and I hope you get there. It's possible that your
requirements for permissions can be done with a few simple conditions. For
a majority of applications, though, it often is not that simple. I think
everyone would rather have a simpler system.

The built-in permission system that Django uses is actually relatively
simple (IMO), and only contains a couple of conditional statements (are you
a super user or do you have permission X in your list of permissions). The
most complex portion is probably the nested object wrappers that allow
permission checks directly within templates, and in reality that code has
nothing to do with the permission check itself.

You'll probably find that your requirements over time will outgrow your
simple permission system if your application has even a small amount of
success.

-James

-- 
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 post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CA%2Be%2BciVcYUNB-FoFHSv46y4Q5oyxPr%3D_a6AGcHB3ihVMn0Cvgw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to