2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-03 20:20:58 +00:00
This commit is contained in:
Matthias
2021-12-02 17:24:07 +01:00
162 changed files with 65207 additions and 59759 deletions

View File

@ -108,7 +108,9 @@ class BaseInvenTreeSetting(models.Model):
for key, value in settings.items():
validator = cls.get_setting_validator(key)
if cls.validator_is_bool(validator):
if cls.is_protected(key):
value = '***'
elif cls.validator_is_bool(validator):
value = InvenTree.helpers.str2bool(value)
elif cls.validator_is_int(validator):
try:
@ -485,7 +487,7 @@ class BaseInvenTreeSetting(models.Model):
elif self.is_int():
return 'integer'
else:
return 'string'
@ -538,6 +540,19 @@ class BaseInvenTreeSetting(models.Model):
return value
@classmethod
def is_protected(cls, key):
"""
Check if the setting value is protected
"""
key = str(key).strip().upper()
if key in cls.GLOBAL_SETTINGS:
return cls.GLOBAL_SETTINGS[key].get('protected', False)
else:
return False
def settings_group_options():
"""build up group tuple for settings based on gour choices"""