This is a followup for #4228.
When a user is a member of more than one group, stock items owned by one of these groups are read-only despite the group having VACD rights on stock items.
After further investigation it seems stock item ownership is broken in general. Even when the stock item is owned by the current user it appears read-only.
The stock item is modifiable by the user.
InvenTree-Version: 0.10.0 dev
Django Version: 3.2.16
Commit Hash: 28ec6b9
Commit Date: 2022-12-25
Database: postgresql
Debug-Mode: False
Deployed using Docker: False
Active plugins: [{'name': 'InvenTreeBarcode', 'slug': 'inventreebarcode', 'version': '2.0.0'}]
Can reproduce. @sur5r thanks for reporting it.
In general:
Fixing this should solely focus on getting documented behaviour up and running again. Permissions are due for a rework as described in #2323. That is a more significant conceptual change that should be discussed on a process level before changing the core mechanism.
Ok, I finally found the error and I am amazed we did not notice this earlier. All owner checks are returning false if you are not a superuser.
And it is kind of obvious once you discover it. We are comparing user objects with owner objects. That can only be false. Seems like most users (I too) deploy a lot of users as superusers.
return user in owner.get_related_owners(include_group=True)
It seems to work partially. Group membership for ownership works, but the permission bits are not respected at all. If I remove the ACD permissions for Stock Items and Stock Locations from the group, my user can still perform stock take actions. But maybe this is part of #2323. While it doesn't seem like a complete fix, it works for my use case.
Owner Name | inventree |
Repo Name | InvenTree |
Full Name | inventree/InvenTree |
Language | Python |
Created Date | 2017-03-23 |
Updated Date | 2023-03-31 |
Star Count | 2586 |
Watcher Count | 61 |
Fork Count | 411 |
Issue Count | 141 |
Issue Title | Created Date | Updated Date |
---|