mirror of https://github.com/jumpserver/jumpserver
feat: 修改oid获取顺序,添加从cookie中获取
parent
82f70cb0dc
commit
4d4a107101
|
@ -11,12 +11,18 @@ from .models import Organization
|
|||
|
||||
|
||||
def get_org_from_request(request):
|
||||
oid = request.META.get("HTTP_X_JMS_ORG")
|
||||
# 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…
Reference in New Issue