Commit Graph

3766 Commits

Author SHA1 Message Date
Oliver Walters
88f73443ee Yet more style fixes 2020-10-06 16:43:39 +11:00
Oliver Walters
77a2b6de8b Merge branch 'part-permissions' of https://github.com/SchrodingersGat/InvenTree into part-permissions 2020-10-06 16:03:33 +11:00
Oliver Walters
b3e4efd96e Unit testing fixes 2020-10-06 16:03:19 +11:00
Oliver
e076470305
Merge branch 'master' into part-permissions 2020-10-06 12:35:45 +11:00
Oliver Walters
d691b15f4b Fix conflicts 2020-10-06 12:34:30 +11:00
Oliver Walters
11d31960c7 Change modal form permissions to use new "role" strategy 2020-10-06 11:42:16 +11:00
Oliver Walters
c740cce5e4 PEP fixes 2020-10-06 11:31:04 +11:00
Oliver Walters
dc2c9aa662 Add InvenTreeRoleMixin
- Simplifies permission requirements for views
- e.g. 'part.view' rather than 'part.view_partcategory'
2020-10-06 11:29:38 +11:00
Oliver Walters
d2e2e7511f Update templates: Change perms to roles 2020-10-06 10:07:39 +11:00
Oliver Walters
fa21d66c41 Fix logic for global context object 'roles'
- User may be a part of multiple groups
- Roles are additive across groups
2020-10-06 09:54:37 +11:00
Oliver Walters
23aee234f0 Change index page to use roles rather than perms to determine user permissions 2020-10-06 09:32:05 +11:00
Oliver Walters
556ffa1099 Change label for permissions to match django permission names 2020-10-06 09:28:05 +11:00
Oliver Walters
8b2189daca Add global context 'roles'
- Access via template e.g. {% if roles.part.view %}
- Always True if the user is a superuser
2020-10-06 09:27:22 +11:00
Oliver
e74bfb90a5
Merge pull request #1025 from eeintech/fixed_group_redundant_saves
Fixed Group model permissions redundant saves
2020-10-06 07:40:44 +11:00
eeintech
d980da7247 Fixed permission assign test unit 2020-10-05 10:52:47 -05:00
eeintech
c910307ce5 Only saving Group model rulesets on instance creation and when inlines are saved 2020-10-05 10:04:54 -05:00
Oliver Walters
3f59ce3f93 Update unit tests
- requires the user to actually have the necessary permissions!
2020-10-06 01:30:36 +11:00
Oliver Walters
16d720b62c Update permission requirements for API
- Automatically use model permissions by default!
-
2020-10-06 00:36:55 +11:00
Oliver Walters
8ee16d6f98 update translation files 2020-10-06 00:20:57 +11:00
Oliver Walters
ba4c829b10 Add permission requirements in various part templates 2020-10-06 00:20:45 +11:00
Oliver Walters
afadd51a14 Fix permissions in views.py
Silly, "add" not "create"
2020-10-06 00:19:44 +11:00
Oliver Walters
66bdce3d04 Hide elements on the PartCategory page, based on permissions 2020-10-05 23:53:24 +11:00
Oliver Walters
4d49cb029f Change part views to require permissions
Also adds custom 403 page
2020-10-05 23:49:32 +11:00
Oliver
796e89c921
Merge pull request #1023 from SchrodingersGat/index-permissions
Change what elements the user can see on the index page
2020-10-05 23:19:13 +11:00
Oliver Walters
3e9c7cda21 Change what elements the user can see on the index page, based on permissions! 2020-10-05 23:11:55 +11:00
Oliver
e5960f6ce4
Merge pull request #1022 from SchrodingersGat/permission-fixes
Fixes for role permissions
2020-10-05 23:04:50 +11:00
Oliver Walters
806a7f961d Fixes for role permissions
- Fixed a strange interaction if multiple rulesets referred to the same models
- Order of operations was incorrect.
- Now is good? Yes!
2020-10-05 22:57:05 +11:00
Oliver
731c796254
Merge pull request #1011 from SchrodingersGat/navbar-permissions
Hide main elements of navigation bar based on user permissions
2020-10-05 11:17:41 +11:00
Oliver
dc41231fcc
Merge pull request #1018 from SchrodingersGat/group-roles
Roles and Permissions
2020-10-05 11:16:52 +11:00
Oliver
cc05220263
Merge pull request #1020 from SchrodingersGat/stock-building
Add "is_building" field to StockItem model
2020-10-05 10:08:40 +11:00
Oliver Walters
898c604b3b Fix incorrect permission names
- Uses the app_model name, *NOT* the name of the database table
- Adds extra tests to ensure that permissions get assigned and removed correctly
2020-10-05 08:55:15 +11:00
Oliver Walters
095ef51991 Cleanup unit testing 2020-10-05 08:29:36 +11:00
Oliver Walters
bce7eb1aad update translation files 2020-10-05 01:02:36 +11:00
Oliver Walters
13cd8624b2 Fix permissions 2020-10-05 01:01:56 +11:00
Oliver Walters
48e050d317 Add some more unit tests and validation code for the StockItem model
- Ensure that the build part matches the stockitem part!
2020-10-05 00:49:00 +11:00
Oliver Walters
3ee7be1d58 Add "optional" field to BomItem
- Defaults to False
- Indicates that the BomItem is "optional" for a build
- Will be used in the future when calculating if a Build output is fully allocated!
2020-10-05 00:42:09 +11:00
Oliver Walters
c1595396c4 Unit testing: fix PEP issues 2020-10-05 00:29:31 +11:00
Oliver Walters
fe3a72c6cc Add some unit testing 2020-10-05 00:29:06 +11:00
Oliver Walters
26d113e8ad Update IN_STOCK_FILTER to reject stock items which have is_building set to True 2020-10-05 00:14:04 +11:00
Oliver Walters
ee28b4eea5 Add "is_building" field to StockItem model
- This will be set to TRUE until a stock item has been completed
2020-10-05 00:12:42 +11:00
Oliver
7f3ce9b0b1
Merge pull request #1019 from SchrodingersGat/installed-stock-improvements
Improvements for the "Installed Items" tab for StockItem display
2020-10-05 00:09:23 +11:00
Oliver Walters
62734c4b72 Add a custom template for the install item form 2020-10-05 00:01:01 +11:00
Oliver Walters
3fe0886207 Remove a debug statement 2020-10-04 23:49:01 +11:00
Oliver Walters
852da6d696 Fix form validation 2020-10-04 23:48:15 +11:00
Oliver Walters
42a75a8238 Add hidden input to the InstallStockForm form
- keeps track of "part" object
- so we can filter the stock_items queryset if the form validation fails
- Is there a more djangonic way of doing this??
2020-10-04 23:45:52 +11:00
Oliver Walters
46f459b4c7 Better display of stock table 2020-10-04 23:34:02 +11:00
Oliver Walters
b9291c6705 Improve transaction note recording for the StockItem model 2020-10-04 23:33:43 +11:00
Oliver Walters
824ce6778f Progress bar tweaks
- If no maximum value supplied, just show the value (and fill to 100% width)
2020-10-04 23:33:20 +11:00
Oliver Walters
3c5968ef1a Add subrow table to the "installed items" view
Ah, javascript...
2020-10-04 22:58:41 +11:00
Oliver Walters
9c27680202 Finish function to install stock item(s) 2020-10-04 21:32:21 +11:00