Revision d3c47597
Modification des tests suite aux changements apportés hier (migration des tests du modèle).
Adaptations dans le code de vigiboard pour utiliser l'authentification fournie par le modèle.
Certains tests fonctionnels de vigiboard sont SKIPés car bugués.
vigiboard.config.vigiboard renommé en vigiboard.config.vigiboard_cfg pour éviter des conflits de noms.
Dans le modèle, User.groups est renommé en User.usergroups pour éviter une confusion avec les groupes d'hosts.
git-svn-id: https://vigilo-dev.si.c-s.fr/svn@624 b22e2e97-25c9-44ff-b637-2e5ceca36478
vigiboard/config/app_cfg.py | ||
---|---|---|
1 |
# -*- coding: utf-8 -*- |
|
1 | 2 |
# vim: set fileencoding=utf-8 sw=4 ts=4 et : |
2 |
from __future__ import absolute_import |
|
3 |
|
|
4 | 3 |
""" |
5 | 4 |
Global configuration file for TG2-specific settings in vigiboard. |
6 | 5 |
|
... | ... | |
17 | 16 |
|
18 | 17 |
from tg.configuration import AppConfig |
19 | 18 |
|
19 |
class MyAppConfig(AppConfig): |
|
20 |
"""We overload AppConfig to prevent it from loading init_model()""" |
|
21 |
|
|
22 |
def __init__(self): |
|
23 |
AppConfig.__init__(self) |
|
24 |
|
|
25 |
def setup_sqlalchemy(self): |
|
26 |
""" |
|
27 |
TG2 needs to configure the DB session before anything else, then it |
|
28 |
calls init_model(). In our case, the DB session is already configured |
|
29 |
so the function call is unnecessary. We suppress TG2's behaviour here. |
|
30 |
""" |
|
31 |
pass |
|
32 |
|
|
20 | 33 |
import vigiboard |
21 |
import vigiboard.model |
|
34 |
from vigiboard import model |
|
35 |
from vigiboard.lib import app_globals, helpers |
|
22 | 36 |
|
23 |
base_config = AppConfig() |
|
37 |
base_config = MyAppConfig()
|
|
24 | 38 |
base_config.renderers = [] |
25 | 39 |
|
26 | 40 |
base_config.package = vigiboard |
... | ... | |
35 | 49 |
|
36 | 50 |
#Configure the base SQLALchemy Setup |
37 | 51 |
base_config.use_sqlalchemy = True |
38 |
base_config.model = vigiboard.model
|
|
39 |
base_config.DBSession = vigiboard.model.DBSession
|
|
52 |
base_config.model = model |
|
53 |
base_config.DBSession = model.DBSession |
|
40 | 54 |
|
41 | 55 |
# Configure the authentication backend |
42 | 56 |
base_config.auth_backend = 'sqlalchemy' |
43 |
base_config.sa_auth.dbsession = vigiboard.model.DBSession
|
|
57 |
base_config.sa_auth.dbsession = model.DBSession |
|
44 | 58 |
# what is the class you want to use to search for users in the database |
45 |
base_config.sa_auth.user_class = vigiboard.model.User
|
|
59 |
base_config.sa_auth.user_class = model.User |
|
46 | 60 |
# what is the class you want to use to search for groups in the database |
47 |
base_config.sa_auth.group_class = vigiboard.model.Group
|
|
61 |
base_config.sa_auth.group_class = model.UserGroup
|
|
48 | 62 |
# what is the class you want to use to search for permissions in the database |
49 |
base_config.sa_auth.permission_class = vigiboard.model.Permission |
|
63 |
base_config.sa_auth.permission_class = model.Permission |
|
64 |
# The name "groups" is already used for groups of hosts. |
|
65 |
# We use "usergroups" when referering to users to avoid confusion. |
|
66 |
base_config.sa_auth.translations.groups = 'usergroups' |
|
50 | 67 |
|
51 | 68 |
# override this if you would like to provide a different who plugin for |
52 | 69 |
# managing login and logout of your application |
... | ... | |
59 | 76 |
# You may optionally define a page where you want users to be redirected to |
60 | 77 |
# on logout: |
61 | 78 |
base_config.sa_auth.post_logout_url = '/post_logout' |
79 |
|
Also available in: Unified diff