Commit graph

15 commits

Author SHA1 Message Date
Aurélien Delobelle aa405d212a Fix tests…
…due to merge of aureplop/kfet-auth
2017-10-24 19:44:02 +02:00
Aurélien Delobelle c524da22fe Merge branch 'aureplop/kfet-auth' into aureplop/kfet-auth_cms
+ Move migrations.
+ Update tests to use new url names and new permissions.
2017-10-24 19:41:45 +02:00
Aurélien Delobelle 097ee44131 Organize migrations to avoid issues with…
…migrations already applied from master.
2017-10-17 16:50:39 +02:00
Aurélien Delobelle 2c76bea1e6 Better display of objects of BasePermissionsField
- Permissions are grouped by content type and displayed under its
verbose_name_plural.
- Default permissions appear before custom ones.
- Use `permissions-field` class to enhance display.
2017-10-17 16:50:39 +02:00
Aurélien Delobelle 07f1a53532 CMS permissions can be managed from group views.
These permissions concern pages, images, documents and access to the
wagtail admin site. Only appropriate elements can be selected: only the
kfet root page and its descendants, same for the kfet root collection
(for images and documents), and kfet snippets (MemberTeam).

Add django-formset-js as dependency to help manipulate formsets.

K-Fêt groups created from "devdata" commands get suitable permissions
for the CMS.
2017-10-17 16:50:39 +02:00
Aurélien Delobelle 82582866b4 Clean forms/views/urls related to kfetauth.Group…
…and it becomes possible to add extra forms/formsets to the create and
update group views.
2017-10-17 16:50:39 +02:00
Aurélien Delobelle 5502c6876a Clean permissions objects
- Define default permissions of kfet models.
- Unused default permissions are deleted.
- `kfet.manage_perms` is now splitted as `kfetauth.(view|add|change)_group` permissions.
2017-10-17 16:49:45 +02:00
Aurélien Delobelle e6fab703ee Use convenience imports 2017-10-12 13:42:06 +02:00
Aurélien Delobelle 085a068020 Merge branch 'aureplop/kfet-auth' into aureplop/kfet-auth_perms 2017-10-12 11:07:16 +02:00
Aurélien Delobelle ded824bddd Cleaner use of Group in kfet app
KFetGroup model
- Provides a distinction from non-kfet Groups.
- Convert code appropriately.
- Initially filled from Groups containing K-Fêt (this was the previous
distinction) in the kfetauth.0002 migration.

Permission proxy model (kfetauth app)
- Proxy of the django.contrib.auth Permission model.
- Adds the 'kfet' manager which returns only kfet-related permissions.

KeepUnselectableModelFormMixin
- Helps to keep the unselectable items of many-to-many field for
ModelForm.
- 'kfetauth' forms (related to KFetGroup) use this mixin.

Using KFetGroup allows to simplify the 'kfet/account_group_form.html' template.

A bug is also fixed in 'kfet/form_field_snippet.html', which could lead to
prevent field displays if they used CheckboxSelectMultiple widget.
2017-09-29 22:37:30 +02:00
Aurélien Delobelle b42452080f Mass cleaning of kfet' authentication machinery
AccountBackend
- Should now work if used in AUTHENTICATION_BACKENDS settings.
- It does not retieve itself the password, as it should not be used
this way.

GenericBackend
- Delete useless 'username' arg of its 'authenticate()' method.
- Now delete the token in DB.

TemporaryAuthMiddleware
- New name of the middleware is more meaningful.
- Is now responsible to retrieve the password from the request, instead
of the AccountBackend.

GenericTeamToken model
- Add a manager' method to create token, avoiding possible error due to
unicity constraint.

GenericLoginView (authentication with the kfet generic user)
- Replace obscure system with a 100% HTTP handling.
- See comments for more information.

Misc
- More docstrings!
- More tests!
- Add some i18n.
- Add kfet/confirm_form.html template:
    Ask user to confirm sth via a form (which will send a POST request).
    Context variables:
        * title: the page title
        * confirm_url: action attribute for <form>
        * text: displayed confirmation text
- kfet.js : Add functions allowing to emit POST request from <a> tag.
- Non-link nav items from kfet navbar also get a 'title'.
- A utility has been found for the 'sunglasses' glyphicon!
2017-09-25 17:57:47 +02:00
Aurélien Delobelle 3fa7754ff4 KFet Backends inherit from BaseKFetBackend
Users who authenticate via a KFetBackend got extra select related.
It should save 2 db queries on each request for these users.
2017-09-23 20:48:28 +02:00
Aurélien Delobelle e5d19811e8 Clean code related to kfet password 2017-09-22 23:31:46 +02:00
Aurélien Delobelle 1d19d1797c Clean setup/retrieve of kfet generic account 2017-09-22 01:24:44 +02:00
Aurélien Delobelle bf61e41b50 Move auth-related from 'kfet' app to 'kfet.auth'. 2017-09-19 17:05:51 +02:00