liquid_feedback_frontend
diff app/main/_prefork/10_init.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 | 73e8b4e48078 |
| children | cd497eb8fd73 |
line diff
1.1 --- a/app/main/_prefork/10_init.lua Thu Jun 23 03:30:57 2016 +0200 1.2 +++ b/app/main/_prefork/10_init.lua Sun Jul 15 14:07:29 2018 +0200 1.3 @@ -1,4 +1,4 @@ 1.4 -config.app_version = "3.2.1" 1.5 +config.app_version = "4.0.0-pre" 1.6 1.7 -- TODO abstraction 1.8 -- get record by id 1.9 @@ -64,6 +64,61 @@ 1.10 config.ldap = {} 1.11 end 1.12 1.13 +if config.oauth2 then 1.14 + local scopes = { 1.15 + { scope = "authentication", name = { de = "Identität feststellen (nur Screen-Name)", en = "Determine identity (screen name only)" } }, 1.16 + { scope = "identification", name = { de = "Identität feststellen", en = "Determine identity" } }, 1.17 + { scope = "notify_email", name = { de = "E-Mail-Adresse für Benachrichtigungen verwenden", en = "Use email address for notifications" } }, 1.18 + { scope = "read_contents", name = { de = "Inhalte lesen", en = "Read content" } }, 1.19 + { scope = "read_authors", name = { de = "Autorennamen lesen", en = "Read author names" } }, 1.20 + { scope = "read_ratings", name = { de = "Bewertungen lesen", en = "Read ratings" } }, 1.21 + { scope = "read_identities", name = { de = "Identitäten lesen", en = "Read identities" } }, 1.22 + { scope = "read_profiles", name = { de = "Profile lesen", en = "Read profiles" } }, 1.23 + { scope = "post", name = { de = "Neue Inhalte veröffentlichen", en = "Post new content" } }, 1.24 + { scope = "rate", name = { de = "Bewertungen vornehmen", en = "Do ratings" } }, 1.25 + { scope = "vote", name = { de = "Abstimmen", en = "Vote" } }, 1.26 + { scope = "delegate", name = { de = "Delegieren", en = "Delegate" } }, 1.27 + { scope = "profile", name = { de = "Eigenes Profil lesen", en = "Read your profile" } }, 1.28 + { scope = "settings", name = { de = "Einstellungen einsehen", en = "Read your settings" } }, 1.29 + { scope = "update_name", name = { de = "Screen-Namen ändern", en = "Update screen name" } }, 1.30 + { scope = "update_notify_email", name = { de = "E-Mail-Adresse für Benachrichtigungen ändern", en = "Update notify email address" } }, 1.31 + { scope = "update_profile", name = { de = "Profil bearbeiten", en = "Update your profile" } }, 1.32 + { scope = "update_settings", name = { de = "Benutzereinstellungen ändern", en = "Update your settings" } } 1.33 + } 1.34 + local s = config.oauth2.available_scopes or {} 1.35 + for i, scope in ipairs(scopes) do 1.36 + s[#s+1] = scope 1.37 + end 1.38 + config.oauth2.available_scopes = s 1.39 + if not config.oauth2.endpoint_magic then 1.40 + config.oauth2.endpoint_magic = "liquidfeedback_client/redirection_endpoint" 1.41 + end 1.42 + if not config.oauth2.manifest_magic then 1.43 + config.oauth2.manifest_magic = "liquidfeedback_client/manifest" 1.44 + end 1.45 + if not config.oauth2.host_func then 1.46 + config.oauth2.host_func = function(domain) return extos.pfilter(nil, "host", "-t", "TXT", domain) end 1.47 + end 1.48 + if not config.oauth2.authorization_code_lifetime then 1.49 + config.oauth2.authorization_code_lifetime = 5 * 60 1.50 + end 1.51 + if not config.oauth2.refresh_token_lifetime then 1.52 + config.oauth2.refresh_token_lifetime = 60 * 60 * 24 * 30 * 3 1.53 + end 1.54 + if not config.oauth2.refresh_pause then 1.55 + config.oauth2.refresh_pause = 60 1.56 + end 1.57 + if not config.oauth2.refresh_grace_period then 1.58 + config.oauth2.refresh_grace_period = 60 1.59 + end 1.60 + if not config.oauth2.access_token_lifetime then 1.61 + config.oauth2.access_token_lifetime = 60 * 60 1.62 + end 1.63 + if not config.oauth2.dynamic_registration_lifetime then 1.64 + config.oauth2.dynamic_registration_lifetime = 60 * 60 * 24 1.65 + end 1.66 +end 1.67 + 1.68 if not config.database then 1.69 config.database = { engine='postgresql', dbname='liquid_feedback' } 1.70 end 1.71 @@ -135,10 +190,22 @@ 1.72 1.73 request.set_absolute_baseurl(config.absolute_base_url) 1.74 1.75 +-- TODO remove style cache 1.76 + 1.77 listen(listen_options) 1.78 1.79 listen{ 1.80 { 1.81 + proto = "main", 1.82 + name = "process_event_stream", 1.83 + handler = function(poll) 1.84 + Event:process_stream(poll) 1.85 + end 1.86 + } 1.87 +} 1.88 + 1.89 +listen{ 1.90 + { 1.91 proto = "interval", 1.92 name = "send_pending_notifications", 1.93 delay = 5, 1.94 @@ -149,11 +216,6 @@ 1.95 end 1.96 end 1.97 while true do 1.98 - if not Event:send_next_notification() then 1.99 - break 1.100 - end 1.101 - end 1.102 - while true do 1.103 if not InitiativeForNotification:notify_next_member() then 1.104 break 1.105 end