diff --git a/itsm/misc/views.py b/itsm/misc/views.py index 128385cd7..204d45bb5 100644 --- a/itsm/misc/views.py +++ b/itsm/misc/views.py @@ -45,6 +45,7 @@ validate_filepath_settings, validate_files_name, ) +from itsm.component.drf.permissions import IamAuthPermit from itsm.component.utils.response import Fail, Success from itsm.iadmin.models import SystemSettings from weixin.core.decorators import weixin_login_exempt @@ -55,6 +56,8 @@ def clean_cache(request): """清理缓存""" + perm = IamAuthPermit() + perm.iam_auth(request, ["global_settings_manage"]) try: cursor = connection.cursor() diff --git a/itsm/role/validators.py b/itsm/role/validators.py index b935803f1..5bac700e8 100644 --- a/itsm/role/validators.py +++ b/itsm/role/validators.py @@ -45,7 +45,7 @@ def __call__(self, value): project_key = value.get("project_key", DEFAULT_PROJECT_PROJECT_KEY) members = list_by_separator(value.get("members", "")) - if self.role.id != value.get("id"): + if getattr(self.role, "id", None) != value.get("id"): raise serializers.ValidationError(_("角色 ID 异常")) if not RoleType.objects.filter(type=role_type).exists():