Bastien Sevajol 9 years ago
parent
commit
fb4c9c3fc8
2 changed files with 16 additions and 3 deletions
  1. 12 3
      tracim/tracim/lib/auth/base.py
  2. 4 0
      tracim/tracim/lib/auth/internal.py

+ 12 - 3
tracim/tracim/lib/auth/base.py View File

@@ -1,14 +1,15 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 from tg.util import Bunch
3 3
 
4
+""" Backup of config.sa_auth """
4 5
 _original_sa_auth = None
5 6
 
6 7
 
7 8
 def _get_clean_sa_auth(config):
8 9
     """
9
-    TODO COMMENT
10
-    :param config:
11
-    :return:
10
+    Return the original sa_auth parameter. Consider Original as it's content before first fill in configuration.
11
+    :param config: tg2 app config
12
+    :return: original sa_auth parameter
12 13
     """
13 14
     global _original_sa_auth
14 15
 
@@ -21,13 +22,21 @@ def _get_clean_sa_auth(config):
21 22
 
22 23
 
23 24
 class Auth:
25
+    """
26
+    Auth strategy base class
27
+    """
24 28
 
29
+    """ Auth strategy must be named: .ini config will use this name in auth_type parameter """
25 30
     name = NotImplemented
26 31
 
27 32
     def __init__(self, config):
28 33
         self._config = config
29 34
 
30 35
     def wrap_config(self):
36
+        """
37
+        Fill config with auth needed. You must overload with whild implementation.
38
+        :return:
39
+        """
31 40
         self._config['sa_auth'] = _get_clean_sa_auth(self._config)
32 41
 
33 42
         # override this if you would like to provide a different who plugin for

+ 4 - 0
tracim/tracim/lib/auth/internal.py View File

@@ -11,6 +11,10 @@ class InternalAuth(Auth):
11 11
     name = 'internal'
12 12
 
13 13
     def wrap_config(self):
14
+        """
15
+        Fill config with internal (database) auth information.
16
+        :return:
17
+        """
14 18
         super().wrap_config()
15 19
 
16 20
         self._config['sa_auth'].user_class = User