Ajoute une restriction de vue sur la vue d'initialisation des questions secrètes

This commit is contained in:
Benjamin Dauvergne 2015-02-04 16:16:46 +01:00
parent 27bc7dd3d6
commit 2733ba5064
2 changed files with 9 additions and 1 deletions

View File

@ -60,7 +60,7 @@ setup(name='authentic2-auf',
],
entry_points={
'authentic2.plugin': [
'authentic2-auf= authentic2_auf:Plugin',
'authentic2-auf=authentic2_auf:Plugin',
],
},
)

View File

@ -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'