summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-02-04 15:16:46 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2015-02-04 15:16:46 (GMT)
commit2733ba5064ebad03e60dff28a9d79b34a97cb31b (patch)
treebcca303ed7a10c62c3bc40dbf602d8015207312d
parent27bc7dd3d64dcd4b0248e87a68533436ec467771 (diff)
downloadauf-2733ba5064ebad03e60dff28a9d79b34a97cb31b.zip
auf-2733ba5064ebad03e60dff28a9d79b34a97cb31b.tar.gz
auf-2733ba5064ebad03e60dff28a9d79b34a97cb31b.tar.bz2
Ajoute une restriction de vue sur la vue d'initialisation des questions secrètesHEADmaster
-rwxr-xr-xauthentic2/setup.py2
-rw-r--r--authentic2/src/authentic2_auf/__init__.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/authentic2/setup.py b/authentic2/setup.py
index 15df8e1..cc3a896 100755
--- a/authentic2/setup.py
+++ b/authentic2/setup.py
@@ -60,7 +60,7 @@ setup(name='authentic2-auf',
],
entry_points={
'authentic2.plugin': [
- 'authentic2-auf= authentic2_auf:Plugin',
+ 'authentic2-auf=authentic2_auf:Plugin',
],
},
)
diff --git a/authentic2/src/authentic2_auf/__init__.py b/authentic2/src/authentic2_auf/__init__.py
index 5ef155d..9c9d643 100644
--- a/authentic2/src/authentic2_auf/__init__.py
+++ b/authentic2/src/authentic2_auf/__init__.py
@@ -60,3 +60,11 @@ class Plugin(object):
- os.path.join(settings.STATIC_URL, 'authentic2/img/ok.png')
'''
return []
+
+ def check_view_restrictions(self, request):
+ from auf.django.secretquestions.models import Answer
+ from django.db.models import Model
+
+ if request.user.is_authenticated() and isinstance(request.user, Model) and \
+ not Answer.objects.filter(user=request.user).exists():
+ return 'authentic2-auf-secret-questions'