author | sylvain.thenault@logilab.fr |
Thu, 30 Apr 2009 00:41:52 +0200 | |
branch | tls-sprint |
changeset 1554 | 3a3263df6cdd |
parent 1398 | 5fe84a5f7035 |
child 1802 | d628defebc17 |
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') ) |
|
671 | 26 |
|
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) |