|
|
@ -24,7 +24,7 @@ import ConfigParser |
|
|
|
from lxml import etree |
|
|
|
from itertools import chain |
|
|
|
|
|
|
|
from odoo import api, fields, models |
|
|
|
from odoo import api, models, fields |
|
|
|
from odoo.tools.config import config as system_base_config |
|
|
|
|
|
|
|
from .system_info import get_server_environment |
|
|
@ -243,11 +243,25 @@ class ServerConfiguration(models.TransientModel): |
|
|
|
res['fields'] = xfields |
|
|
|
return res |
|
|
|
|
|
|
|
@api.model |
|
|
|
def _is_secret(self, key): |
|
|
|
""" |
|
|
|
This method is intended to be inherited to defined which keywords |
|
|
|
should be secret. |
|
|
|
:return: list of secret keywords |
|
|
|
""" |
|
|
|
secret_keys = ['passw', 'key', 'secret', 'token'] |
|
|
|
return any(secret_key in key for secret_key in secret_keys) |
|
|
|
|
|
|
|
@api.model |
|
|
|
def default_get(self, fields_list): |
|
|
|
res = {} |
|
|
|
current_user = self.env.user |
|
|
|
if not current_user.has_group( |
|
|
|
'server_environment.has_server_configuration_access'): |
|
|
|
return res |
|
|
|
for key in self._conf_defaults: |
|
|
|
if 'passw' in key and not self.show_passwords: |
|
|
|
if not self.show_passwords and self._is_secret(key=key): |
|
|
|
res[key] = '**********' |
|
|
|
else: |
|
|
|
res[key] = self._conf_defaults[key]() |
|
|
|