Skip to content

Commit

Permalink
Merge pull request #1412 from longguikeji/v2.5-dev
Browse files Browse the repository at this point in the history
V2.5 dev
  • Loading branch information
notevery committed Nov 16, 2022
2 parents 5cc8db2 + 4ff2781 commit f6ee86b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
13 changes: 2 additions & 11 deletions api/v1/views/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,10 @@ def auth(request, tenant_id: str, event_tag: str, data: AuthIn):
# 生成 token
token = refresh_token(user)
dispatch_task.delay('async_get_arkstore_access_token', tenant.id.hex, token)
netloc = request.get_host().split(':')[0]
domain = request.get_host().split(':')[0]

is_ip_addr = False
ip_list = netloc.split('.')
if len(ip_list) == 4 and ''.join(ip_list).isdigit():
is_ip_addr = True

domain = ('.'.join(netloc.split('.')[-2:]))
response = JsonResponse({'error': ErrorCode.OK.value, 'data': {'user': {"id": user.id.hex, "username": user.username}, 'token': token}})
if is_ip_addr:
response.set_cookie("arkid_token", token, httponly=True)
else:
response.set_cookie("arkid_token", token, domain=domain, httponly=True)
response.set_cookie("arkid_token", token, domain=domain, httponly=True)

return response

Expand Down
3 changes: 2 additions & 1 deletion api/v1/views/permission_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ def get_permissions_from_group(request, tenant_id: str, permission_group_id: str
entry_permission = app.entry_permission
elif name and name in app.entry_permission.name:
entry_permission = app.entry_permission

if category is None and operation_id is None and name is None and app.entry_permission:
entry_permission = app.entry_permission
if app_name and app_name not in app.name:
entry_permission = None
# 需要过滤展示
Expand Down
2 changes: 1 addition & 1 deletion arkid/common/arkstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ def refresh_admin_uesr_token():
admin_user = User.active_objects.filter(
username='admin', tenant=platform_tenant
).first()
token = ExpiringToken.active_objects.filter(user=admin_user).first()
token = ExpiringToken.objects.filter(user=admin_user).first()
if not token.expired:
return token.token

Expand Down

0 comments on commit f6ee86b

Please sign in to comment.