You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Django provides for "user permissions" which can apply to individual users or entire groups. These can provide fine-grained control of what users can access / read / write / delete (etc).
I think this would be a good way to approach the problem, and create a "guest" account which can only view certain parts of the data.
However this functionality needs to be used to actually restrict access to the particular data. I would also like to see it coded in way that is not particular to a single InvenTree instance (e.g. at the very least it covers InvenTree in a generic way, or it can be extended to meet particular needs).
Oh I never shared my thoughts on the actual implementation...
My idea is to focus on group/role based permissions although user based permissions would of course still work. I plan on sticking with the default Django permissions as I think they should be good enough (view, change, add, delete).
You'd create a group in the admin panel and set whatever permissions you would like that group to have, then add users to that group. These would be the broad restrictions that would apply to the API and top level UI elements, based on the model. These can be implemented with just Django.
In order to use object based permissions we need a per object authentication backend like django-guardian, since that isn't natively supported in Django. On creation (or while being edited) each object should have a form that can be used to pick which groups have access to that object. What object permissions they have should be based on that groups model permissions, to keep it simple.
You can use the admin panel to set user permissions per object or to fine tune the group permissions per object, but I think that's a bit much to add to the front end UI.
I wound up with this approach since it was easier to implement an anonymous user and would add more to the project.
Activity
SchrodingersGat commentedon Dec 21, 2019
Django provides for "user permissions" which can apply to individual users or entire groups. These can provide fine-grained control of what users can access / read / write / delete (etc).
I think this would be a good way to approach the problem, and create a "guest" account which can only view certain parts of the data.
However this functionality needs to be used to actually restrict access to the particular data. I would also like to see it coded in way that is not particular to a single InvenTree instance (e.g. at the very least it covers InvenTree in a generic way, or it can be extended to meet particular needs).
Docs:
Zeigren commentedon Feb 17, 2020
Oh I never shared my thoughts on the actual implementation...
My idea is to focus on group/role based permissions although user based permissions would of course still work. I plan on sticking with the default Django permissions as I think they should be good enough (view, change, add, delete).
You'd create a group in the admin panel and set whatever permissions you would like that group to have, then add users to that group. These would be the broad restrictions that would apply to the API and top level UI elements, based on the model. These can be implemented with just Django.
In order to use object based permissions we need a per object authentication backend like django-guardian, since that isn't natively supported in Django. On creation (or while being edited) each object should have a form that can be used to pick which groups have access to that object. What object permissions they have should be based on that groups model permissions, to keep it simple.
You can use the admin panel to set user permissions per object or to fine tune the group permissions per object, but I think that's a bit much to add to the front end UI.
I wound up with this approach since it was easier to implement an anonymous user and would add more to the project.
SchrodingersGat commentedon Oct 5, 2020
Hi @Zeigren check out the implementation in #1018
Does this meet your requirements here?
eeintech commentedon Jan 13, 2021
@SchrodingersGat I think we should close this ticket, the role and permission system definitely allows for visitor/public/view-only profile.
SchrodingersGat commentedon Jan 13, 2021
Agreed, thanks for bringing this to my attention @eeintech