liquid_feedback_frontend

view app/main/registration_admin/role_verification.lua @ 1858:3d1f0464a3ea

Handle missing ldap.member.allowed function
author bsw
date Tue Sep 20 17:35:29 2022 +0200 (20 months ago)
parents 7e328a78da93
children
line source
1 local verification = RoleVerification:by_id(param.get_id())
2 local data = verification.verification_data or verification.request_data
4 local identification = config.role_registration.identification_func(data)
5 local member
6 if verification.verified_member_id then
7 member = Member:by_id(verification.verified_member_id)
8 identification = member.identification
9 end
11 local group, title, view
12 if verification.verified then
13 if member.deleted then
14 group = _"Cancelled accounts"
15 title = _"Cancelled account"
16 view = "role_verification_cancelled"
17 else
18 group = _"Accredited users"
19 title = member.identification
20 view = "role_verification_accredited"
21 end
22 elseif verification.denied then
23 group = "Rejected requests"
24 title = _"Rejected request"
25 view = "role_verification_rejected"
26 else
27 group = "Open requests"
28 title = _"Open request"
29 view = "role_verification_requests"
30 end
33 ui.title(function()
34 ui.link { module = "registration_admin", view = "index", content = _"Role management" }
35 slot.put ( " » " )
36 ui.link { module = "registration_admin", view = view, content = group }
37 slot.put ( " » " )
38 ui.tag { tag = "span", content = title }
39 end)
40 app.html_title.title = _"Role management"
42 ui.container{ attr = { class = "mdl-grid" }, content = function()
43 ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
44 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
45 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
46 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = title }
47 end }
50 ui.form{
51 module = "registration_admin", action = "update_role_verification", id = verification.id,
52 routing = { ok = { mode = "redirect", module = "registration_admin", view = view } },
53 record = data,
54 content = function()
56 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
58 for i, field in ipairs(config.role_registration.fields) do
59 ui.container{ content = function()
60 ui.field.text{
61 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
62 attr = { id = "lf-register__data_" .. field.name, class = "mdl-textfield__input" },
63 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-register__data" .. field.name },
64 label = field.label,
65 name = field.name
66 }
68 ui.tag{ content = verification.request_data[field.name] }
69 end }
70 end
72 ui.field.text{
73 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label", style = "width: 30em;" },
74 attr = { id = "lf-register__data_identification", class = "mdl-textfield__input" },
75 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-register__data_identification" },
76 label = "Identification",
77 name = "identification",
78 value = identification
79 }
81 end }
83 local member = Member:by_id(verification.requesting_member_id)
84 ui.container{ attr = { class = "mdl-card__content" }, content = function()
85 ui.tag{ content = _"Requested by:" }
86 slot.put(" ")
87 ui.link{ content = member.name, module = "member", view = "show", id = member.id }
88 end }
90 ui.container{ attr = { class = "mdl-card__actions mdl-card--border" }, content = function()
92 if verification.denied then
93 ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" }
94 elseif verification.verified then
95 ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save role data" }
96 slot.put("   ")
97 if not member.activated then
98 ui.submit{ name = "invite", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Send email invitation again" }
99 slot.put("   ")
100 end
101 ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" }
102 slot.put("   ")
103 ui.submit{ name = "cancel", attr = { class = "mdl-button mdl-js-button" }, value = _"Delete account" }
104 else
105 ui.submit{ name = "accredit", attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Accredit role" }
106 slot.put("   ")
107 ui.submit{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, value = "Save role data" }
108 slot.put("   ")
109 ui.link{ attr = { class = "mdl-button mdl-js-button mdl-button--raised" }, module = "registration_admin", view = view, content = "Back" }
110 slot.put("   ")
111 ui.submit{ name = "drop", attr = { class = "mdl-button mdl-js-button" }, value = "Reject request" }
112 end
113 end }
115 end
116 }
117 end }
119 local verifications = RoleVerification:new_selector()
120 :join("member", nil, "member.id = role_verification.verified_member_id")
121 :add_where{ "member.identification = ?", identification }
122 :add_where{ "role_verification.id <> ?", verification.id }
123 :exec()
125 if #verifications > 0 then
127 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
128 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
129 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
130 ui.tag{ content = _"Same identification" }
131 end }
132 end }
133 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
134 execute.view{ module = "registration_admin", view = "_role_verification_list", params = { verifications = verifications } }
135 end }
136 end }
137 end
139 for i, field_name in ipairs(config.role_registration.match_fields) do
140 local field
141 for j, f in ipairs(config.role_registration.fields) do
142 if f.name == field_name then
143 field = f
144 end
145 end
146 local verifications = Verification:new_selector()
147 :add_where("verified NOTNULL")
148 :add_where{ "lower(request_data->>'" .. field.name .. "') = lower(?)", data[field.name] }
149 :add_where{ "verification.id <> ?", verification.id }
150 :exec()
152 if #verifications > 0 then
153 ui.container{ attr = { class = "mdl-card mdl-card__fullwidth mdl-shadow--2dp" }, content = function()
154 ui.container{ attr = { class = "mdl-card__title mdl-card--border" }, content = function()
155 ui.heading { attr = { class = "mdl-card__title-text" }, level = 2, content = function()
156 ui.tag{ content = _"Same " .. field.label }
157 end }
158 end }
159 ui.container{ attr = { class = "mdl-card__content mdl-card--border" }, content = function()
160 execute.view{ module = "registration_admin", view = "_verification_list", params = { verifications = verifications } }
161 end }
162 end }
163 end
164 end
166 end }
167 end }

Impressum / About Us