Browse Source

working on documentation

still don't like ReST
master
Holger Frey 7 years ago
parent
commit
ac9b484229
  1. 4
      ordr2/models/users.py
  2. 10
      ordr2/security.py

4
ordr2/models/users.py

@ -54,9 +54,9 @@ class User(Base):
id = Column(Integer, primary_key=True) id = Column(Integer, primary_key=True)
#: unique user name #: unique user name
username = Column(Text, nullable=False, unique=True) username = Column(Text, nullable=False, unique=True)
#: hashed password, see ``ordr2.security`` #: hashed password, see :mod:`ordr2.security`
password_hash = Column(Text, nullable=False) password_hash = Column(Text, nullable=False)
#: role of the user, see ``ordr2.models.users.Role`` #: role of the user, see :class:`ordr2.models.users.Role`
role = Column(Enum(Role), nullable=False) role = Column(Enum(Role), nullable=False)
first_name = Column(Text, nullable=False) first_name = Column(Text, nullable=False)

10
ordr2/security.py

@ -31,7 +31,15 @@ class AuthenticationPolicy(AuthTktAuthenticationPolicy):
def get_user(request): def get_user(request):
''' retrieves the user object by the unauthenticated user id ''' ''' retrieves the user object by the unauthenticated user id
:param request:
the current request object
:type request:
pyramid.request.Request
:rtype:
ordr2.models.users.User or None
'''
user_id = request.unauthenticated_userid user_id = request.unauthenticated_userid
if user_id is not None: if user_id is not None:
user = request.dbsession.query(User).filter_by(id=user_id).first() user = request.dbsession.query(User).filter_by(id=user_id).first()