liquid_feedback_frontend
diff app/main/oauth2/session.lua @ 1309:32cc544d5a5b
Cumulative patch for upcoming frontend version 4
author | bsw/jbe |
---|---|
date | Sun Jul 15 14:07:29 2018 +0200 (2018-07-15) |
parents | |
children | 25ea15b4bd5e |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/app/main/oauth2/session.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -0,0 +1,32 @@ 1.4 +if not request.is_post() then 1.5 + return execute.view { module = "index", view = "405" } 1.6 +end 1.7 + 1.8 +slot.set_layout(nil, "application/json") 1.9 + 1.10 +local r = json.object{ 1.11 + member_id = json.null 1.12 +} 1.13 + 1.14 +if app.session.member_id then 1.15 + local origin = request.get_header("Origin") 1.16 + if origin then 1.17 + local system_applications = SystemApplication:by_origin(origin) 1.18 + if #system_applications > 0 then 1.19 + r.member_id = app.session.member_id 1.20 + r.real_member_id = app.session.real_member_id 1.21 + if app.session.member.role then 1.22 + r.member_is_role = true 1.23 + end 1.24 + else 1.25 + local member_application = MemberApplication:by_member_id_and_origin(app.session.member_id, origin) 1.26 + if member_application then 1.27 + r.member_id = app.session.member_id 1.28 + r.real_member_id = app.session.real_member_id 1.29 + end 1.30 + end 1.31 + end 1.32 +end 1.33 + 1.34 +slot.put_into("data", json.export(r)) 1.35 +