annotate app/main/api/application.lua @ 1559:7eda69e1d14f
Fixed layout of incoming delegations in vote view
author |
bsw |
date |
Tue Nov 10 20:29:19 2020 +0100 (2020-11-10) |
parents |
32cc544d5a5b |
children |
fa82e72afdfe |
rev |
line source |
bsw/jbe@1309
|
1 slot.set_layout(nil, "application/json")
|
bsw/jbe@1309
|
2
|
bsw/jbe@1309
|
3 local r = json.array()
|
bsw/jbe@1309
|
4
|
bsw/jbe@1309
|
5 local system_applications = SystemApplication:get_all()
|
bsw/jbe@1309
|
6
|
bsw/jbe@1309
|
7 r[#r+1] = json.object{
|
bsw/jbe@1309
|
8 type = "system",
|
bsw/jbe@1309
|
9 name = "LiquidFeedback",
|
bsw/jbe@1309
|
10 base_url = request.get_absolute_baseurl(),
|
bsw/jbe@1309
|
11 manifest_url = request.get_absolute_baseurl() .. "api/1/info",
|
bsw/jbe@1309
|
12 cert_common_name = config.oauth2.cert_common_name
|
bsw/jbe@1309
|
13 }
|
bsw/jbe@1309
|
14
|
bsw/jbe@1309
|
15 for i, system_application in ipairs(system_applications) do
|
bsw/jbe@1309
|
16 r[#r+1] = json.object{
|
bsw/jbe@1309
|
17 type = "system",
|
bsw/jbe@1309
|
18 name = system_application.name,
|
bsw/jbe@1309
|
19 base_url = system_application.base_url,
|
bsw/jbe@1309
|
20 manifest_url = system_application.manifest_url,
|
bsw/jbe@1309
|
21 cert_common_name = system_application.cert_common_name
|
bsw/jbe@1309
|
22 }
|
bsw/jbe@1309
|
23 end
|
bsw/jbe@1309
|
24
|
bsw/jbe@1309
|
25 if app.access_token then
|
bsw/jbe@1309
|
26
|
bsw/jbe@1309
|
27 local member_applications = MemberApplication:by_member_id_with_domain(app.access_token.member_id)
|
bsw/jbe@1309
|
28
|
bsw/jbe@1309
|
29 for i, member_application in ipairs(member_applications) do
|
bsw/jbe@1309
|
30 r[#r+1] = json.object{
|
bsw/jbe@1309
|
31 type = "dynamic",
|
bsw/jbe@1309
|
32 name = "https://" .. member_application.domain .. "/",
|
bsw/jbe@1309
|
33 base_url = "https://" .. member_application.domain .. "/",
|
bsw/jbe@1309
|
34 manifest_url = "https://" .. member_application.domain .. "/" .. config.oauth2.manifest_magic
|
bsw/jbe@1309
|
35 }
|
bsw/jbe@1309
|
36 end
|
bsw/jbe@1309
|
37
|
bsw/jbe@1309
|
38 end
|
bsw/jbe@1309
|
39
|
bsw/jbe@1309
|
40 slot.put_into("data", json.export(json.object{ result = r }))
|