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

V2.5 dev #1412

Merged
merged 5 commits into from
Nov 16, 2022
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
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