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
 
6
 
7
 from tracim.models.auth import User
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
 # CURRENT_USER_WEB = 'WEB'
11
 # CURRENT_USER_WEB = 'WEB'
11
 # CURRENT_USER_WSGIDAV = 'WSGIDAV'
12
 # CURRENT_USER_WSGIDAV = 'WSGIDAV'
12
 
13
 
55
         if email and self._user and user.user_id==self._user.user_id:
56
         if email and self._user and user.user_id==self._user.user_id:
56
             pass
57
             pass
57
             # this is required for the _session to keep on being up-to-date
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
             # tg.request.identity['repoze.who.userid'] = email
61
             # tg.request.identity['repoze.who.userid'] = email
60
             # tg.auth_force_login(email)
62
             # tg.auth_force_login(email)
61
 
63
 
95
         #from tracim.lib.calendar import CalendarManager
97
         #from tracim.lib.calendar import CalendarManager
96
         #from tracim.model.organisational import UserCalendar
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
         # Ensure database is up-to-date
108
         # Ensure database is up-to-date
101
         self._session.flush()
109
         self._session.flush()
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
 # class CurrentUserGetterInterface(object):
121
 # class CurrentUserGetterInterface(object):
114
 #     def get_current_user(self) -> typing.Union[None, User]:
122
 #     def get_current_user(self) -> typing.Union[None, User]:
115
 #         raise NotImplementedError()
123
 #         raise NotImplementedError()

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

126
     is_active = Column(Boolean, default=True, nullable=False)
126
     is_active = Column(Boolean, default=True, nullable=False)
127
     imported_from = Column(Unicode(32), nullable=True)
127
     imported_from = Column(Unicode(32), nullable=True)
128
     timezone = Column(Unicode(255), nullable=False, server_default='')
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
     auth_token = Column(Unicode(255))
131
     auth_token = Column(Unicode(255))
130
     auth_token_created = Column(DateTime)
132
     auth_token_created = Column(DateTime)
131
 
133
 
263
                 roles.append(role)
265
                 roles.append(role)
264
         return roles
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
     def ensure_auth_token(self, validity_seconds, session) -> None:
270
     def ensure_auth_token(self, validity_seconds, session) -> None:
267
         """
271
         """
268
         Create auth_token if None, regenerate auth_token if too much old.
272
         Create auth_token if None, regenerate auth_token if too much old.