annotate app/main/api/application.lua @ 1790:20c1c8cc28ba
Splitted different meanings of rejected, specified context of accepted and invited
 | author | 
 bsw | 
 | date | 
 Wed Oct 20 15:48:51 2021 +0200 (2021-10-20) | 
 | parents | 
 fa82e72afdfe  | 
 | children | 
  | 
 
 | 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@1670
 | 
     7 local base_url = request.get_absolute_baseurl()
 | 
| 
bsw@1670
 | 
     8 
 | 
| 
bsw@1670
 | 
     9 if string.sub(base_url, -1, -1) == "/" then
 | 
| 
bsw@1670
 | 
    10   base_url = string.sub(base_url, 1, -2)
 | 
| 
bsw@1670
 | 
    11 end
 | 
| 
bsw@1670
 | 
    12 
 | 
| 
bsw/jbe@1309
 | 
    13 r[#r+1] = json.object{
 | 
| 
bsw/jbe@1309
 | 
    14   type = "system",
 | 
| 
bsw/jbe@1309
 | 
    15   name = "LiquidFeedback",
 | 
| 
bsw@1670
 | 
    16   base_url = base_url,
 | 
| 
bsw/jbe@1309
 | 
    17   manifest_url = request.get_absolute_baseurl() .. "api/1/info",
 | 
| 
bsw/jbe@1309
 | 
    18   cert_common_name = config.oauth2.cert_common_name
 | 
| 
bsw/jbe@1309
 | 
    19 }
 | 
| 
bsw/jbe@1309
 | 
    20 
 | 
| 
bsw/jbe@1309
 | 
    21 for i, system_application in ipairs(system_applications) do
 | 
| 
bsw/jbe@1309
 | 
    22   r[#r+1] = json.object{
 | 
| 
bsw/jbe@1309
 | 
    23     type = "system",
 | 
| 
bsw/jbe@1309
 | 
    24     name = system_application.name,
 | 
| 
bsw/jbe@1309
 | 
    25     base_url = system_application.base_url,
 | 
| 
bsw/jbe@1309
 | 
    26     manifest_url = system_application.manifest_url,
 | 
| 
bsw/jbe@1309
 | 
    27     cert_common_name = system_application.cert_common_name
 | 
| 
bsw/jbe@1309
 | 
    28   }
 | 
| 
bsw/jbe@1309
 | 
    29 end
 | 
| 
bsw/jbe@1309
 | 
    30 
 | 
| 
bsw/jbe@1309
 | 
    31 if app.access_token then
 | 
| 
bsw/jbe@1309
 | 
    32 
 | 
| 
bsw/jbe@1309
 | 
    33   local member_applications = MemberApplication:by_member_id_with_domain(app.access_token.member_id)
 | 
| 
bsw/jbe@1309
 | 
    34 
 | 
| 
bsw/jbe@1309
 | 
    35   for i, member_application in ipairs(member_applications) do
 | 
| 
bsw/jbe@1309
 | 
    36     r[#r+1] = json.object{
 | 
| 
bsw/jbe@1309
 | 
    37       type = "dynamic",
 | 
| 
bsw/jbe@1309
 | 
    38       name = "https://" .. member_application.domain .. "/",
 | 
| 
bsw/jbe@1309
 | 
    39       base_url = "https://" .. member_application.domain .. "/",
 | 
| 
bsw/jbe@1309
 | 
    40       manifest_url = "https://" .. member_application.domain .. "/" .. config.oauth2.manifest_magic
 | 
| 
bsw/jbe@1309
 | 
    41     }
 | 
| 
bsw/jbe@1309
 | 
    42   end
 | 
| 
bsw/jbe@1309
 | 
    43 
 | 
| 
bsw/jbe@1309
 | 
    44 end
 | 
| 
bsw/jbe@1309
 | 
    45 
 | 
| 
bsw/jbe@1309
 | 
    46 slot.put_into("data", json.export(json.object{ result = r }))
 |