Friday, March 17, 2017

Re: superuser having all permissions makes perm checking messy

On Thursday 16 March 2017 02:29:21 guettli wrote:

 

> In our custom code we already skip check1 and do only check2.

 

Why do you even do these checks?

There's a view decorator and class-based view mixin. All you need to do is make good groups and users and the rest follows.

 

If you want to define a new permission type, you can do it in the model meta class. Not one place requires manual permission checks - when you stick to the model level.

 

If you need to enforce permissions at the model instance level, then don't reinvent the wheel. There's a few packages out there, who have already solved the problem - Django Guardian being one of them.

--

Melvyn Sopacua

No comments:

Post a Comment