Remove unnecessary decorator. Add doc.

This commit is contained in:
juanifioren 2015-01-16 10:37:47 -03:00
parent b79c68fd7b
commit 7d6272b668
3 changed files with 4 additions and 19 deletions

View file

@ -1,18 +0,0 @@
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.contrib.auth.decorators import user_passes_test
def staff_required(function=None, redirect_field_name=REDIRECT_FIELD_NAME, login_url=None):
"""
Decorator for views that checks that the user is logged in and is staff,
redirecting to the log-in page if necessary.
"""
actual_decorator = user_passes_test(
lambda u: u.is_authenticated() and u.is_staff,
login_url=login_url,
redirect_field_name=redirect_field_name
)
if function:
return actual_decorator(function)
return actual_decorator

View file

@ -1,4 +1,7 @@
class Params(object):
'''
The purpose of this class is for accesing params via dot notation.
'''
pass

View file

@ -24,7 +24,7 @@ def create_id_token_dic(user, iss, aud):
user_auth_time = time.mktime(user.last_login.timetuple())
dic = {
'iss': iss, # TODO: this should not be hardcoded.
'iss': iss,
'sub': user.id,
'aud': aud,
'exp': exp_time,