Open rodrigondec opened 4 years ago
Hi @rodrigondec!
Thanks for all the details and links, it's a really interessting concept and integration. Honestly i do not see why to refuse a PR on this subject, it seems to be to be a really good enhancement to allow new architecture.
If you do so, please think about:
I will make sure to follow this thread and to help you if you need help with your PR, we will be able to make a release as soon as it will be merged to not let you wait after it.
@RignonNoel we opened the PR #15 :tada:
I'm willing to open PR!
Resume
I'm not using Django/DRF in a traditional way. I'm using a Domain Driven Design architecture.
My ViewSet doesn't have access to my Model classes (my serializers included!).
To use this lib I'm going to overwrite the methods
DRYPermissions.has_permission
andDRYPermissions.has_object_permission
to use myservice
instead ofmodel_class
andobj
respectively.My code
Proposition
Instead of doing
I suggest to create a function to get the 'target' for the permission loookup!
Suggestion of overwritable helper function
This way I could overwrite only the target without duplicating the whole lib!
Another improvement possible is to use **kwargs!
This way anyone who uses this lib may 'ignore' the arguments passed if they don't want it.
permission call
obj permission call