Commit graph

1546 commits

Author SHA1 Message Date
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
df7594a105 Move KFetConfigForm to kfet.config
Import in `ready` method of kfet app config of `kfet.forms` may be
annoying because it starts executing `__init__` methods of fields.
Causing failures if these methods does DB calls, as `ready` may be
called before applying migrations.
2017-10-12 13:53:48 +02:00
Aurélien Delobelle
e6fab703ee Use convenience imports 2017-10-12 13:42:06 +02:00
Martin Pepin
c17ed416c4 Merge branch 'aureplop/kfet-auth_perms' into 'aureplop/kfet-auth'
Cleaner use of Group in kfet app

See merge request !257
2017-10-12 11:30:44 +02:00
Aurélien Delobelle
085a068020 Merge branch 'aureplop/kfet-auth' into aureplop/kfet-auth_perms 2017-10-12 11:07:16 +02:00
Martin Pépin
3b1d8487e2 Merge branch 'aureplop/kfet-auth_backends' 2017-10-11 22:59:28 +02:00
Martin Pépin
528532cca7 Merge branch 'aureplop/fix-ci' 2017-10-10 15:35:22 +02:00
Martin Pépin
4d1cb3c2d7 Set password for redis in CI 2017-10-10 15:26:14 +02:00
Aurélien Delobelle
57a143e0e1 Merge branch 'PEI' into 'master'
Statut PEI + cotisation gratuite

See merge request !258
2017-10-06 11:06:44 +02:00
Martin Pépin
435e211b3d Add a "PEI" status + "Gratis" subscription fees 2017-10-02 13:58:52 +02:00
Aurélien Delobelle
596868f5b6 plop 2017-09-30 03:03:48 +02:00
Aurélien Delobelle
8ea5775d61 Add test for callable queryset with Unselectable… 2017-09-30 02:14:01 +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
Martin Pepin
22413d861c Merge branch 'aureplop/fix-attributions-admin' into 'master'
Fix attribution inlines of participant in admin

See merge request !255
2017-09-25 18:38:05 +02:00
Aurélien Delobelle
d18fb86a98 Fix attribution inlines of participant in admin 2017-09-25 18:26:54 +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
11e8cb1be2 Merge branch 'bdaAdminHotfix' into 'master'
Hotfix : répare l'admin, le champ "given" n'était pas affiché quand il faut

See merge request !254
2017-09-25 15:01:28 +02:00
Martin Pépin
db512a97f6 In /admin: displays "given" when it's relevant 2017-09-25 14:22:46 +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
Martin Pepin
7d16001ee5 Merge branch 'aureplop/fix_kfet_perms' into 'master'
K-Fêt' groups edits don't remove non-kfet app permissions.

Closes #168

See merge request !252
2017-09-12 22:35:30 +02:00
Martin Pépin
1921f05eba Move STATIC_ROOT in production 2017-09-12 09:22:54 +02:00
Martin Pépin
368ee3190f Update CI: use postgres 2017-09-12 00:14:52 +02:00
Aurélien Delobelle
9e61887868 K-Fêt' groups edits don't remove non-kfet app permissions.
Fixes #168.
2017-09-11 16:42:14 +02:00
Martin Pépin
faed7bff73 fix ?next=… on K-Fêt logout 2017-09-10 02:32:21 +02:00
Martin Pepin
f581279825 Merge branch 'aureplop/fix-kfet-navbar' into 'master'
Fix kfet navbar on small devices

See merge request !248
2017-09-10 02:12:49 +02:00
Martin Pépin
937a485704 Merge branch 'master' into Production 2017-09-09 22:03:32 +02:00
Martin Pépin
439f49c3ba We ♥ hardcoding stuff… 2017-09-05 15:21:19 +02:00
Martin Pépin
35b352ac1d Fix mistake introduced in 51f4bf3fb5 2017-09-04 14:50:12 +02:00
Martin Pépin
50432d969f Update available promos for account creation 2017-09-04 13:25:45 +02:00
Martin Pépin
51f4bf3fb5 Clipper logins may be > 8 characters 2017-09-04 13:25:09 +02:00
Aurélien Delobelle
fb5ba5fb1b Fix kfet navbar on small devices 2017-09-03 14:42:38 +02:00
Aurélien Delobelle
1d9310236b Merge branch 'Kerl/setup' into 'master'
Setup de développement local

Développement sans Vagrant

- Ajoute un fichier de settings pour développer en local sans vagrant :
  'cof/settings/local.py'. Il s'agit du fichier utilisé par défaut
  si 'DJANGO_SETTINGS_MODULE' n'est pas dans l'environnement.
- Simplifie le README en conséquence.

Vagrant

La conf de production étant en cours de modification, on répercute ici
certaines de ces modifications.

- Front server: passe à nginx (à la place de apache).
- DB: passe à postgresql (à la place de mysql).
- La conf nginx sert le site (port 8080) derrière '/gestion/', à
  l'exception des fichiers 'static' et 'media'.
- Ajout de `SERVER_EMAIL` dans les secrets pour pouvoir l'éditer en
  production.
- Changement de `STATIC_ROOT` en production.

See merge request !242
2017-08-13 21:17:26 +02:00
Martin Pépin
2a519bfedf Add SCRIPT_NAME to the production-like server 2017-08-13 14:36:45 +01:00
Martin Pépin
4c08962e09 Hide more stuff in secret.py 2017-08-13 13:39:13 +01:00
Martin Pépin
4d026407d1 Quicker setup for local development 2017-08-11 23:56:02 +01:00
Martin Pépin
5923166196 Specify the full path of the sqlite database 2017-08-11 17:24:09 +01:00
Martin Pépin
853fa57ce4 In README.md: typo env -> venv 2017-08-11 15:45:19 +01:00
Martin Pépin
522acafb2e Add python dependency for Debian9 2017-08-10 16:56:20 +01:00
Martin Pépin
dae418af3d Handle websockets in nginx.conf 2017-08-10 16:56:03 +01:00
Martin Pépin
73296ea251 Setup django before launching daphne + Django 2017-08-10 16:55:36 +01:00
Martin Pépin
4075fcaa64 typo 2017-08-10 16:35:41 +01:00
Martin Pépin
bd1dace8e8 Fix symlink for secret.py 2017-08-10 16:31:09 +01:00
Martin Pépin
ad15c45237 Switch to nginx + postgres in vagrant 2017-08-09 22:18:26 +01:00
Martin Pépin
cb1d253517 Local development settings
- Add a new settings file for local development
- Update README.md according to the new setup
2017-08-09 22:17:27 +01:00
Martin Pépin
a6b0c51d39 Add SERVER_EMAIL to the secrets 2017-08-08 00:25:13 +01:00