mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-30 04:26:44 +00:00
PEP fixes
This commit is contained in:
parent
1ded9e1fc0
commit
c09b4980ad
@ -9,10 +9,10 @@ from django.contrib.auth import get_user_model
|
|||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
User = get_user_model()
|
|
||||||
|
|
||||||
from users.models import RuleSet
|
from users.models import RuleSet
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class RuleSetInline(admin.TabularInline):
|
class RuleSetInline(admin.TabularInline):
|
||||||
model = RuleSet
|
model = RuleSet
|
||||||
|
@ -14,7 +14,7 @@ class UsersConfig(AppConfig):
|
|||||||
try:
|
try:
|
||||||
self.assign_permissions()
|
self.assign_permissions()
|
||||||
except (OperationalError, ProgrammingError):
|
except (OperationalError, ProgrammingError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def assign_permissions(self):
|
def assign_permissions(self):
|
||||||
|
|
||||||
@ -30,4 +30,4 @@ class UsersConfig(AppConfig):
|
|||||||
# Update group permission assignments for all groups
|
# Update group permission assignments for all groups
|
||||||
for group in Group.objects.all():
|
for group in Group.objects.all():
|
||||||
|
|
||||||
update_group_roles(group)
|
update_group_roles(group)
|
||||||
|
@ -71,7 +71,7 @@ class RuleSet(models.Model):
|
|||||||
'build_build',
|
'build_build',
|
||||||
'build_builditem',
|
'build_builditem',
|
||||||
'stock_stockitem',
|
'stock_stockitem',
|
||||||
'stock_stocklocation',
|
'stock_stocklocation',
|
||||||
],
|
],
|
||||||
'purchase_order': [
|
'purchase_order': [
|
||||||
'company_company',
|
'company_company',
|
||||||
@ -139,6 +139,7 @@ class RuleSet(models.Model):
|
|||||||
|
|
||||||
return self.RULESET_MODELS.get(self.name, [])
|
return self.RULESET_MODELS.get(self.name, [])
|
||||||
|
|
||||||
|
|
||||||
def update_group_roles(group):
|
def update_group_roles(group):
|
||||||
"""
|
"""
|
||||||
Update group roles:
|
Update group roles:
|
||||||
@ -148,10 +149,10 @@ def update_group_roles(group):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# List of permissions which must be added to the group
|
# List of permissions which must be added to the group
|
||||||
permissions_to_add = []
|
# permissions_to_add = []
|
||||||
|
|
||||||
# List of permissions which must be removed from the group
|
# List of permissions which must be removed from the group
|
||||||
permissions_to_delete = []
|
# permissions_to_delete = []
|
||||||
|
|
||||||
# Get all the rulesets associated with this group
|
# Get all the rulesets associated with this group
|
||||||
for r in RuleSet.RULESET_CHOICES:
|
for r in RuleSet.RULESET_CHOICES:
|
||||||
|
@ -87,4 +87,4 @@ class RuleSetModelTest(TestCase):
|
|||||||
if len(missing_models) > 0:
|
if len(missing_models) > 0:
|
||||||
print("WARNING: The following database models are not covered by the define RuleSet permissions:")
|
print("WARNING: The following database models are not covered by the define RuleSet permissions:")
|
||||||
for m in missing_models:
|
for m in missing_models:
|
||||||
print("-", m)
|
print("-", m)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user