prepare #I96PVK app_common及app_odoo_customize全版本安全优化 置顶

This commit is contained in:
Ivan Office
2024-03-07 18:17:04 +08:00
parent e3655a922d
commit 091e86f3f0
3 changed files with 107 additions and 0 deletions

View File

@@ -53,6 +53,12 @@ EXCLU_FIELDS = [
class Base(models.AbstractModel):
_inherit = 'base'
@api.model
def _app_check_sys_op(self):
if self.env.user.has_group('base.group_erp_manager'):
return True
return False
@api.model
def _get_normal_fields(self):
f_list = []
@@ -103,11 +109,15 @@ class Base(models.AbstractModel):
@api.model
def get_image_from_url(self, url):
# 返回这个图片的base64编码
if not self._app_check_sys_op():
return False
return get_image_from_url(url)
@api.model
def get_image_url2attachment(self, url, mimetype_list=None):
# Todo: mimetype filter
if not self._app_check_sys_op():
return False
image, file_name = get_image_url2attachment(url)
if image and file_name:
try:
@@ -126,6 +136,8 @@ class Base(models.AbstractModel):
@api.model
def get_image_base642attachment(self, data):
if not self._app_check_sys_op():
return False
image, file_name = get_image_base642attachment(data)
if image and file_name:
try: