Browse Source

add comment about existing auth feature

Guénaël Muller 7 years ago
parent
commit
2e5b13d0da
2 changed files with 16 additions and 4 deletions
  1. 12 4
      tracim/lib/core/user.py
  2. 4 0
      tracim/models/auth.py

+ 12 - 4
tracim/lib/core/user.py View File

@@ -6,7 +6,8 @@ import typing as typing
6 6
 
7 7
 from tracim.models.auth import User
8 8
 
9
-# TODO - G.M -28-03-2018 - [CurrentUser] Check if "current user" stuff is always needed for tracimv2
9
+# TODO - G.M -28-03-2018 - [CurrentUser][auth]
10
+#  Check if "current user" stuff is always needed for tracimv2
10 11
 # CURRENT_USER_WEB = 'WEB'
11 12
 # CURRENT_USER_WSGIDAV = 'WSGIDAV'
12 13
 
@@ -55,7 +56,8 @@ class UserApi(object):
55 56
         if email and self._user and user.user_id==self._user.user_id:
56 57
             pass
57 58
             # this is required for the _session to keep on being up-to-date
58
-            # TODO - G.M - 28-03-2018 - [CurrentUser] Check for pyramid equivalent
59
+            # TODO - G.M - 28-03-2018 -
60
+            # [CurrentUser] Check for pyramid equivalent
59 61
             # tg.request.identity['repoze.who.userid'] = email
60 62
             # tg.auth_force_login(email)
61 63
 
@@ -95,7 +97,13 @@ class UserApi(object):
95 97
         #from tracim.lib.calendar import CalendarManager
96 98
         #from tracim.model.organisational import UserCalendar
97 99
 
98
-        created_user.ensure_auth_token(session=self._session, validity_seconds=self._config.USER_AUTH_TOKEN_VALIDITY)
100
+        # TODO - G.M - 04-04-2018 - [auth]
101
+        # Check if this is already needed with
102
+        # new auth system
103
+        created_user.ensure_auth_token(
104
+            session=self._session,
105
+            validity_seconds=self._config.USER_AUTH_TOKEN_VALIDITY
106
+        )
99 107
 
100 108
         # Ensure database is up-to-date
101 109
         self._session.flush()
@@ -109,7 +117,7 @@ class UserApi(object):
109 117
         # )
110 118
 
111 119
 
112
-# TODO - G.M - 28-03-2018 - [CurrentUser] Check for pyramid equivalent
120
+# TODO - G.M - 28-03-2018 - [CurrentUser][auth] Check for pyramid equivalent
113 121
 # class CurrentUserGetterInterface(object):
114 122
 #     def get_current_user(self) -> typing.Union[None, User]:
115 123
 #         raise NotImplementedError()

+ 4 - 0
tracim/models/auth.py View File

@@ -126,6 +126,8 @@ class User(DeclarativeBase):
126 126
     is_active = Column(Boolean, default=True, nullable=False)
127 127
     imported_from = Column(Unicode(32), nullable=True)
128 128
     timezone = Column(Unicode(255), nullable=False, server_default='')
129
+    # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed
130
+    # with new auth system
129 131
     auth_token = Column(Unicode(255))
130 132
     auth_token_created = Column(DateTime)
131 133
 
@@ -263,6 +265,8 @@ class User(DeclarativeBase):
263 265
                 roles.append(role)
264 266
         return roles
265 267
 
268
+    # TODO - G.M - 04-04-2018 - [auth] Check if this is already needed
269
+    # with new auth system
266 270
     def ensure_auth_token(self, validity_seconds, session) -> None:
267 271
         """
268 272
         Create auth_token if None, regenerate auth_token if too much old.