Skip to content

Commit

Permalink
fix: 修复清除缓存鉴权、用户组新增异常的问题 --story=119850966
Browse files Browse the repository at this point in the history
  • Loading branch information
benero committed Oct 6, 2024
1 parent 42533e9 commit ff099ea
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions itsm/misc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -55,6 +56,8 @@

def clean_cache(request):
"""清理缓存"""
perm = IamAuthPermit()
perm.iam_auth(request, ["global_settings_manage"])

try:
cursor = connection.cursor()
Expand Down
2 changes: 1 addition & 1 deletion itsm/role/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit ff099ea

Please sign in to comment.