diff --git a/InvenTree/users/fixtures/users.yaml b/InvenTree/users/fixtures/users.yaml new file mode 100644 index 0000000000..5103953ca1 --- /dev/null +++ b/InvenTree/users/fixtures/users.yaml @@ -0,0 +1,53 @@ +- model: auth.group + pk: 1 + fields: + name: "Viewers" + +- model: auth.group + pk: 2 + fields: + name: "Engineers" + +- model: auth.group + pk: 3 + fields: + name: "Sales" + +- model: auth.user + pk: 1 + fields: + username: "sue_the_superuser" + is_superuser: true + +- model: auth.user + pk: 2 + fields: + username: "engineer_eddie" + groups: + - 2 + is_active: true + is_staff: false + is_superuser: false + +- model: auth.user + pk: 3 + fields: + username: "alanallgroup" + first_name: "Alan" + last_name: "Allgroup" + is_active: false + groups: + - 1 + - 2 + - 3 + +- model: auth.user + pk: 4 + fields: + username: "sam" + first_name: "Samuel" + last_name: "Salesperson" + groups: + - 3 + is_staff: true + is_superuser: true diff --git a/tasks.py b/tasks.py index 7a6e952b15..81c4ab5678 100644 --- a/tasks.py +++ b/tasks.py @@ -286,6 +286,8 @@ def export_records(c, filename='data.json'): # Dump data to temporary file manage(c, cmd, pty=True) + print("Running data post-processing step...") + # Post-process the file, to remove any "permissions" specified for a group with open(tmpfile, "r") as f_in: data = json.loads(f_in.read()) @@ -365,6 +367,9 @@ def import_fixtures(c): 'location', 'stock_tests', 'stock', + + # Users + 'users' ] command = 'loaddata ' + ' '.join(fixtures)