Browse Source

feat: 修改oid获取顺序,添加从cookie中获取

pull/4090/head
ibuler 5 years ago
parent
commit
4d4a107101
  1. 12
      apps/orgs/utils.py

12
apps/orgs/utils.py

@ -11,12 +11,18 @@ from .models import Organization
def get_org_from_request(request):
# query中优先级最高
oid = request.GET.get("oid")
# 其次header
if not oid:
oid = request.META.get("HTTP_X_JMS_ORG")
# 其次cookie
if not oid:
oid = request.COOKIES.get('X-JMS-ORG')
# 其次session
if not oid:
oid = request.session.get("oid")
request_params_oid = request.GET.get("oid")
if request_params_oid:
oid = request.GET.get("oid")
if not oid:
oid = Organization.DEFAULT_ID

Loading…
Cancel
Save