devmonkey22 / oso-casemgmt-django Goto Github PK
View Code? Open in Web Editor NEWCase Management Authorization Example using Oso in Django and Django REST Framework
License: MIT License
Case Management Authorization Example using Oso in Django and Django REST Framework
License: MIT License
To complete proper support for creating new objects (i.e. POST methods), it isn't sufficient to just use DRF filter_backends
against a given model. There isn't a model yet created. There are probably several approaches, but the one I recommend (that has been working well in a different app) is the following:
get_parent_object()
view method
allow(user, "add_case", client)
)To support this more generic approach, models may need a few details embedded on their class like:
class AuthorizeMeta
:
A generic approach obviously can be very powerful, but can be complex to implement. Your use case may vary.
As extensions to this approach, I also have implemented elsewhere things like:
authorized_view
to apply to the APIView
or GenericAPIView
(subclasses) which will auto-add the base authorization filter and permission classes, if one isn't explicitly added to the view's filter_backends
or permission_classes
.get()
etc handlers with information that just isn't feasible to expose through generic permission or filter classes.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.