-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Per-actions Permissions. #5
Comments
Decorators take various kwargs.
🔨: Using |
Hello Carlton, |
Hi @tissieres. I'm still working on the details of the desired API here. Normally I'd be very grateful for input but I do want to handle this one myself. A first pass would be to implement a We're still at the early stage here so there's no wrong answers yet. I know that's not very specific but I hope it helps. |
No problem. I will test some approaches on my side and if I find something really elegant, I'll come back to you. Thanks for neapolitan, fun project! |
Thanks! Let me know what you come up with! |
That was simple finally:
I also added a check of the permissions in the |
Yes, wrapping the view callbacks in |
Hi @carltongibson! We spoke at djangocon about this, and whether we could do something with django-fastview's permission system. (Documentation and source) I've looked at it more closely and have some ideas, but how far do you want to go with permission support? If we just want a hook for access control to be left to the user, we can use or clone Django's If you're up for more syntactic sugar and functionality, I'm thinking about refactoring fastview's permission stuff into a separate project, and am thinking about what it would look like. I would love to use it with Neapolitan - either by using hooks to write it as a mixin in mine, or building it in directly as a dependency. As a user I'd like to end up with something like this:
with a way to manage permissions for specific roles, perhaps:
(Not entirely sure about As I say, a lot of this is already achievable by subclassing, but we are missing a couple of bits for some nice-to-have features: Support in action links We would probably want to hide action links when they're not available. The It may be worth having a separate Support for checking objects I'd like to be able to check based on the object a user is trying to access etc - eg being able to say only the owner of the object can edit it. This is possible now, but would result in an extra query or two. The neatest solution would be to call We would probably also need to add Filtering in list view I would like to be able to control who can see what on the list view. It really needs to be separate to the main List permission (eg any logged in user can see the list view, but they can only see their data), something like:
It would be a very simple change to |
I was working on a project with Neapolitan, and ended up abandoning neapolitan for that because I couldn't figure it out. Overriding |
Thanks all. Yes, again, I have patterns in the WORK project that I need to pull out to advance here. Essence if it is to apply view level permissions before dispatching the handler, table level permissions in or just after get_queryset and row level permissions in or just after get_object. |
Scenario:
Needs a hook into
ModelView.get_urls()
since parsing the end-list to wrap the view callbacks isn't fun.But the most vanilla approach is to wrap the view, rather than add a DRF-style
check_permissions()
hook on the view class itself.The text was updated successfully, but these errors were encountered: