Title edition support

This commit is contained in:
Éloi Rivard 2023-03-11 22:34:29 +01:00
parent 0e6a6ee943
commit 2c4c3fb37e
9 changed files with 90 additions and 68 deletions

View file

@ -17,6 +17,7 @@ Added
- Server side pagination. :issue:`114` :pr:`111`
- Department number support. :issue:`129`
- Address edition support (but not in the OIDC claims yet) :pr:`112`
- Title edition support :pr:`113`
Fixed
*****

View file

@ -148,6 +148,7 @@ WRITE = [
"preferredLanguage",
"employeeNumber",
"departmentNumber",
"title",
]
[ACL.ADMIN]

View file

@ -135,6 +135,7 @@ PROFILE_FORM_FIELDS = dict(
validators=[wtforms.validators.DataRequired()],
),
cn=wtforms.StringField(_("Name")),
title=wtforms.TelField(_("Title"), render_kw={"placeholder": _("Vice president")}),
givenName=wtforms.StringField(
_("Given name"),
render_kw={

View file

@ -120,7 +120,8 @@
<div class="thirteen wide column">
{% endif %}
<div class="two fields">
{% if "givenName" in form or "sn" in form or "title" in fields %}
<div class="equal width fields">
{% if "givenName" in form %}
{% block given_name_field scoped %}{{ render_field(form.givenName) }}{% endblock %}
{% endif %}
@ -129,6 +130,7 @@
{% block sn_field scoped %}{{ render_field(form.sn) }}{% endblock %}
{% endif %}
</div>
{% endif %}
{% if "displayName" in form %}
{% block display_name_field scoped %}{{ render_field(form.displayName) }}{% endblock %}
@ -136,6 +138,10 @@
{% if "jpegPhoto" in form %}</div></div>{% endif %}
{% if "title" in form %}
{% block title_field scoped %}{{ render_field(form.title) }}{% endblock %}
{% endif %}
{% if "mail" in form %}
{% block mail_field scoped %}{{ render_field(form.mail) }}{% endblock %}
{% endif %}
@ -152,7 +158,7 @@
{% block street_field scoped %}{{ render_field(form.street) }}{% endblock %}
{% endif %}
<div class="fluid equal width fields">
<div class="equal width fields">
{% if "postalCode" in form %}
{% block postal_code_field scoped %}{{ render_field(form.postalCode) }}{% endblock %}
{% endif %}

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PROJECT VERSION\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2023-03-11 20:12+0100\n"
"POT-Creation-Date: 2023-03-11 22:33+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -66,7 +66,7 @@ msgstr ""
msgid "You are already logged in, you cannot create an account."
msgstr ""
#: canaille/account.py:336 canaille/forms.py:267 canaille/forms.py:329
#: canaille/account.py:336 canaille/forms.py:268 canaille/forms.py:330
#: canaille/templates/groups.html:5 canaille/templates/groups.html:16
#: canaille/templates/partial/users.html:18
#: canaille/themes/default/base.html:61
@ -144,7 +144,7 @@ msgid "Email"
msgstr ""
#: canaille/admin.py:29 canaille/forms.py:75 canaille/forms.py:99
#: canaille/forms.py:171 canaille/forms.py:323
#: canaille/forms.py:172 canaille/forms.py:324
msgid "jane@doe.com"
msgstr ""
@ -172,7 +172,7 @@ msgstr ""
msgid "John Doe"
msgstr ""
#: canaille/apputils.py:34 canaille/forms.py:134 canaille/forms.py:311
#: canaille/apputils.py:34 canaille/forms.py:134 canaille/forms.py:312
msgid "jdoe"
msgstr ""
@ -213,15 +213,15 @@ msgstr ""
msgid "Login"
msgstr ""
#: canaille/forms.py:85 canaille/forms.py:108 canaille/forms.py:216
#: canaille/forms.py:85 canaille/forms.py:108 canaille/forms.py:217
msgid "Password"
msgstr ""
#: canaille/forms.py:111 canaille/forms.py:220
#: canaille/forms.py:111 canaille/forms.py:221
msgid "Password confirmation"
msgstr ""
#: canaille/forms.py:114 canaille/forms.py:223
#: canaille/forms.py:114 canaille/forms.py:224
msgid "Password and confirmation do not match."
msgstr ""
@ -229,137 +229,145 @@ msgstr ""
msgid "Automatic"
msgstr ""
#: canaille/forms.py:133 canaille/forms.py:310
#: canaille/forms.py:133 canaille/forms.py:311
msgid "Username"
msgstr ""
#: canaille/forms.py:137 canaille/forms.py:282 canaille/forms.py:296
#: canaille/forms.py:137 canaille/forms.py:283 canaille/forms.py:297
#: canaille/oidc/forms.py:17 canaille/templates/partial/groups.html:6
#: canaille/templates/partial/oidc/admin/client_list.html:6
#: canaille/templates/partial/users.html:12
msgid "Name"
msgstr ""
#: canaille/forms.py:139
#: canaille/forms.py:138
msgid "Title"
msgstr ""
#: canaille/forms.py:138
msgid "Vice president"
msgstr ""
#: canaille/forms.py:140
msgid "Given name"
msgstr ""
#: canaille/forms.py:141
#: canaille/forms.py:142
msgid "John"
msgstr ""
#: canaille/forms.py:147
#: canaille/forms.py:148
msgid "Family Name"
msgstr ""
#: canaille/forms.py:150
#: canaille/forms.py:151
msgid "Doe"
msgstr ""
#: canaille/forms.py:156
#: canaille/forms.py:157
msgid "Display Name"
msgstr ""
#: canaille/forms.py:159
#: canaille/forms.py:160
msgid "Johnny"
msgstr ""
#: canaille/forms.py:165 canaille/forms.py:316
#: canaille/forms.py:166 canaille/forms.py:317
msgid "Email address"
msgstr ""
#: canaille/forms.py:167
#: canaille/forms.py:168
msgid ""
"This email will be used as a recovery address to reset the password if "
"needed"
msgstr ""
#: canaille/forms.py:177
#: canaille/forms.py:178
msgid "Phone number"
msgstr ""
#: canaille/forms.py:177
#: canaille/forms.py:178
msgid "555-000-555"
msgstr ""
#: canaille/forms.py:180
#: canaille/forms.py:181
msgid "Address"
msgstr ""
#: canaille/forms.py:182
#: canaille/forms.py:183
msgid "132, Foobar Street, Gotham City 12401, XX"
msgstr ""
#: canaille/forms.py:186
#: canaille/forms.py:187
msgid "Street"
msgstr ""
#: canaille/forms.py:188
#: canaille/forms.py:189
msgid "132, Foobar Street"
msgstr ""
#: canaille/forms.py:192
#: canaille/forms.py:193
msgid "Postal Code"
msgstr ""
#: canaille/forms.py:198
#: canaille/forms.py:199
msgid "Locality"
msgstr ""
#: canaille/forms.py:200 canaille/forms.py:206
#: canaille/forms.py:201 canaille/forms.py:207
msgid "Gotham City"
msgstr ""
#: canaille/forms.py:204
#: canaille/forms.py:205
msgid "Region"
msgstr ""
#: canaille/forms.py:210
#: canaille/forms.py:211
msgid "Photo"
msgstr ""
#: canaille/forms.py:214 canaille/templates/profile.html:105
#: canaille/forms.py:215 canaille/templates/profile.html:105
msgid "Delete the photo"
msgstr ""
#: canaille/forms.py:228
#: canaille/forms.py:229
msgid "Employee number"
msgstr ""
#: canaille/forms.py:230 canaille/forms.py:236
#: canaille/forms.py:231 canaille/forms.py:237
msgid "1234"
msgstr ""
#: canaille/forms.py:234
#: canaille/forms.py:235
msgid "Department number"
msgstr ""
#: canaille/forms.py:240
#: canaille/forms.py:241
msgid "Website"
msgstr ""
#: canaille/forms.py:242
#: canaille/forms.py:243
msgid "https://mywebsite.tld"
msgstr ""
#: canaille/forms.py:246
#: canaille/forms.py:247
msgid "Preferred language"
msgstr ""
#: canaille/forms.py:269
#: canaille/forms.py:270
msgid "users, admins …"
msgstr ""
#: canaille/forms.py:285
#: canaille/forms.py:286
msgid "group"
msgstr ""
#: canaille/forms.py:289 canaille/forms.py:303
#: canaille/forms.py:290 canaille/forms.py:304
#: canaille/templates/partial/groups.html:7
msgid "Description"
msgstr ""
#: canaille/forms.py:314
#: canaille/forms.py:315
msgid "Username editable by the invitee"
msgstr ""
@ -711,7 +719,7 @@ msgstr ""
msgid "Create group"
msgstr ""
#: canaille/templates/group.html:83 canaille/templates/profile.html:297
#: canaille/templates/group.html:83 canaille/templates/profile.html:303
msgid "Submit"
msgstr ""
@ -724,7 +732,7 @@ msgid "Add a group"
msgstr ""
#: canaille/templates/invite.html:5 canaille/templates/invite.html:85
#: canaille/templates/profile.html:292 canaille/templates/users.html:17
#: canaille/templates/profile.html:298 canaille/templates/users.html:17
msgid "Invite a user"
msgstr ""
@ -886,83 +894,83 @@ msgstr ""
msgid "Click to upload a photo"
msgstr ""
#: canaille/templates/profile.html:194
#: canaille/templates/profile.html:200
msgid "Account information"
msgstr ""
#: canaille/templates/profile.html:219
#: canaille/templates/profile.html:225
msgid "User password is not mandatory"
msgstr ""
#: canaille/templates/profile.html:222
#: canaille/templates/profile.html:228
msgid "The user password can be set:"
msgstr ""
#: canaille/templates/profile.html:224
#: canaille/templates/profile.html:230
msgid "by filling this form;"
msgstr ""
#: canaille/templates/profile.html:225
#: canaille/templates/profile.html:231
msgid ""
"by sending the user a password initialization mail, after the account "
"creation;"
msgstr ""
#: canaille/templates/profile.html:226 canaille/templates/profile.html:249
#: canaille/templates/profile.html:232 canaille/templates/profile.html:255
msgid ""
"or simply waiting for the user to sign-in a first time, and then receive "
"a password initialization mail."
msgstr ""
#: canaille/templates/profile.html:229 canaille/templates/profile.html:252
#: canaille/templates/profile.html:235 canaille/templates/profile.html:258
msgid "The user will not be able to authenticate unless the password is set"
msgstr ""
#: canaille/templates/profile.html:238
#: canaille/templates/profile.html:244
msgid "Send email"
msgstr ""
#: canaille/templates/profile.html:242
#: canaille/templates/profile.html:248
msgid "This user does not have a password yet"
msgstr ""
#: canaille/templates/profile.html:245
#: canaille/templates/profile.html:251
msgid "You can solve this by:"
msgstr ""
#: canaille/templates/profile.html:247
#: canaille/templates/profile.html:253
msgid "setting a password using this form;"
msgstr ""
#: canaille/templates/profile.html:248
#: canaille/templates/profile.html:254
msgid "sending the user a password initialization mail, by clicking this button;"
msgstr ""
#: canaille/templates/profile.html:260
#: canaille/templates/profile.html:266
msgid "Send mail"
msgstr ""
#: canaille/templates/mail/admin.html:72 canaille/templates/profile.html:263
#: canaille/templates/mail/admin.html:72 canaille/templates/profile.html:269
#: canaille/templates/reset-password.html:11
#: canaille/templates/reset-password.html:16
msgid "Password reset"
msgstr ""
#: canaille/templates/profile.html:265
#: canaille/templates/profile.html:271
msgid ""
"If the user has forgotten his password, you can send him a password reset"
" email by clicking this button."
msgstr ""
#: canaille/templates/profile.html:277
#: canaille/templates/profile.html:283
msgid "Delete the user"
msgstr ""
#: canaille/templates/profile.html:279
#: canaille/templates/profile.html:285
msgid "Delete my account"
msgstr ""
#: canaille/templates/profile.html:286
#: canaille/templates/profile.html:292
msgid "Impersonate"
msgstr ""

View file

@ -149,6 +149,7 @@ WRITE = [
"preferredLanguage",
"employeeNumber",
"departmentNumber",
"title",
]
[ACL.ADMIN]

View file

@ -149,6 +149,7 @@ WRITE = [
"preferredLanguage",
"employeeNumber",
"departmentNumber",
"title",
]
[ACL.ADMIN]

View file

@ -109,6 +109,7 @@ def configuration(slapd_server, smtpd):
"employeeNumber",
"preferredLanguage",
"departmentNumber",
"title",
],
},
"ADMIN": {

View file

@ -108,6 +108,7 @@ def test_edition(
res.form["st"] = "region"
res.form["employeeNumber"] = 666
res.form["departmentNumber"] = 1337
res.form["title"] = "title"
res.form["groups"] = [
"cn=foo,ou=groups,dc=mydomain,dc=tld",
"cn=bar,ou=groups,dc=mydomain,dc=tld",
@ -135,6 +136,7 @@ def test_edition(
assert logged_user.preferredLanguage == "fr"
assert logged_user.employeeNumber == "666"
assert logged_user.departmentNumber == ["1337"]
assert logged_user.title == ["title"]
assert logged_user.jpegPhoto == [jpeg_photo]
foo_group.reload()