Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复清除缓存鉴权、用户组新增异常的问题 --story=119850966 #1417

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading