author | Nicolas Chauvat <nicolas.chauvat@logilab.fr> |
Mon, 25 May 2009 00:34:11 +0200 | |
branch | stable |
changeset 1918 | a9db0eb45117 |
parent 1802 | d628defebc17 |
child 1977 | 606923dff11b |
permissions | -rw-r--r-- |
0 | 1 |
"""authentication using google authentication service |
2 |
||
3 |
:organization: Logilab |
|
671 | 4 |
:copyright: 2008-2009 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
6 |
""" |
|
7 |
__docformat__ = "restructuredtext en" |
|
8 |
||
9 |
from cubicweb.web.views.basecomponents import UserLink |
|
10 |
from cubicweb.web.views.actions import LogoutAction |
|
11 |
||
12 |
from google.appengine.api import users |
|
13 |
||
14 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
671
diff
changeset
|
15 |
class GACWUserLink(UserLink): |
0 | 16 |
|
17 |
def anon_user_link(self): |
|
18 |
self.w(self.req._('anonymous')) |
|
19 |
self.w(u' [<a class="logout" href="%s">%s</a>]' |
|
20 |
% (users.create_login_url(self.req.url()), self.req._('login'))) |
|
21 |
||
22 |
class GAELogoutAction(LogoutAction): |
|
23 |
||
24 |
def url(self): |
|
25 |
return users.create_logout_url(self.req.build_url('logout') ) |
|
1802
d628defebc17
delete-trailing-whitespace + some copyright update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1398
diff
changeset
|
26 |
|
671 | 27 |
def registration_callback(vreg): |
28 |
if hasattr(vreg.config, 'has_resource'): |
|
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
671
diff
changeset
|
29 |
vreg.register(GACWUserLink, clear=True) |
671 | 30 |
vreg.register(GAELogoutAction, clear=True) |