From 35b047b2f9859c836993026fdd22eeeca950f450 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 8 Apr 2025 05:06:27 +0000 Subject: [PATCH] Add 'users' permission role --- src/backend/InvenTree/users/models.py | 28 +++++++++++++++++---------- src/frontend/src/enums/Roles.tsx | 3 ++- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/src/backend/InvenTree/users/models.py b/src/backend/InvenTree/users/models.py index 8d09c334ac..3117eae532 100644 --- a/src/backend/InvenTree/users/models.py +++ b/src/backend/InvenTree/users/models.py @@ -226,6 +226,7 @@ class RuleSet(models.Model): ('purchase_order', _('Purchase Orders')), ('sales_order', _('Sales Orders')), ('return_order', _('Return Orders')), + ('users', _('Users')), ] RULESET_NAMES = [choice[0] for choice in RULESET_CHOICES] @@ -246,15 +247,6 @@ class RuleSet(models.Model): 'report_reportasset', 'report_reportsnippet', 'report_reporttemplate', - 'account_emailaddress', - 'account_emailconfirmation', - 'socialaccount_socialaccount', - 'socialaccount_socialapp', - 'socialaccount_socialtoken', - 'otp_totp_totpdevice', - 'otp_static_statictoken', - 'otp_static_staticdevice', - 'mfa_authenticator', 'plugin_pluginconfig', 'plugin_pluginsetting', 'plugin_notificationusersetting', @@ -336,6 +328,23 @@ class RuleSet(models.Model): 'order_returnorderlineitem', 'order_returnorderextraline', ], + 'users': [ + 'auth_group', + 'auth_user', + 'auth_permission', + 'users_owner', + 'users_apitoken', + 'users_ruleset', + 'account_emailaddress', + 'account_emailconfirmation', + 'socialaccount_socialaccount', + 'socialaccount_socialapp', + 'socialaccount_socialtoken', + 'otp_totp_totpdevice', + 'otp_static_statictoken', + 'otp_static_staticdevice', + 'mfa_authenticator', + ], } if settings.SITE_MULTI: @@ -366,7 +375,6 @@ class RuleSet(models.Model): 'common_inventreecustomuserstatemodel', 'common_selectionlistentry', 'common_selectionlist', - 'users_owner', 'users_userprofile', # User profile is handled in the serializer - only own user can change # Third-party tables 'error_report_error', diff --git a/src/frontend/src/enums/Roles.tsx b/src/frontend/src/enums/Roles.tsx index 76272c3a28..45ef81cd71 100644 --- a/src/frontend/src/enums/Roles.tsx +++ b/src/frontend/src/enums/Roles.tsx @@ -11,7 +11,8 @@ export enum UserRoles { sales_order = 'sales_order', stock = 'stock', stock_location = 'stock_location', - stocktake = 'stocktake' + stocktake = 'stocktake', + users = 'users' } /*