liquid_feedback_frontend

view app/main/_filter/21_auth.lua @ 765:80a58850bf87

Use terms public available now
author bsw
date Thu Jun 28 23:18:16 2012 +0200 (2012-06-28)
parents f52f918b38b8
children 8e87f9505e34
line source
1 local module = request.get_module()
2 local view = request.get_view()
3 local action = request.get_action()
5 local auth_needed = not (
6 module == 'index'
7 and (
8 view == "index"
9 or view == "login"
10 or action == "login"
11 or view == "register"
12 or action == "register"
13 or view == "about"
14 or view == "reset_password"
15 or action == "reset_password"
16 or view == "confirm_notify_email"
17 or action == "confirm_notify_email"
18 or view == "menu"
19 or action == "set_lang"
20 )
21 )
23 if config.public_access then
25 if
26 module == "area" and view == "show"
27 or module == "unit" and view == "show"
28 or module == "policy" and view == "show"
29 or module == "policy" and view == "list"
30 or module == "issue" and view == "show"
31 or module == "initiative" and view == "show"
32 or module == "suggestion" and view == "show"
33 or module == "draft" and view == "diff"
34 or module == "draft" and view == "show"
35 or module == "draft" and view == "list"
36 or module == "index" and view == "search"
37 or module == "index" and view = "use_terms"
38 then
39 auth_needed = false
40 end
42 end
44 if config.public_access == "full" then
45 if module == "member_image" and view == "show"
46 or module == "vote" and view == "show_incoming"
47 or module == "interest" and view == "show_incoming"
48 or module == "supporter" and view == "show_incoming" then
49 auth_needed = false
50 end
51 end
53 if module == "sitemap" then
54 auth_needed = false
55 end
57 if config.public_access and not app.session.member_id and auth_needed and module == "index" and view == "index" then
58 if config.single_unit_id then
59 request.redirect{ module = "unit", view = "show", id = config.single_unit_id }
60 else
61 request.redirect{ module = "unit", view = "list" }
62 end
63 return
64 end
66 -- if not app.session.user_id then
67 -- trace.debug("DEBUG: AUTHENTICATION BYPASS ENABLED")
68 -- app.session.user_id = 1
69 -- end
71 if auth_needed and app.session.member == nil then
72 trace.debug("Not authenticated yet.")
73 request.redirect{
74 module = 'index', view = 'login', params = {
75 redirect_module = module,
76 redirect_view = view,
77 redirect_id = param.get_id()
78 }
79 }
80 elseif auth_needed and app.session.member.locked then
81 trace.debug("Member locked.")
82 request.redirect{ module = 'index', view = 'login' }
83 else
84 if auth_needed then
85 trace.debug("Authentication accepted.")
86 else
87 trace.debug("No authentication needed.")
88 end
90 --db:query("SELECT check_everything()")
92 execute.inner()
93 trace.debug("End of authentication filter.")
94 end

Impressum / About Us