author | Sylvain Thénault <sylvain.thenault@logilab.fr> |
Tue, 23 Feb 2010 17:32:31 +0100 | |
branch | stable |
changeset 4668 | 9f82f81bf13d |
parent 4212 | ab6573088b4a |
child 5421 | 8167de96c523 |
permissions | -rw-r--r-- |
0 | 1 |
"""authentication using google authentication service |
2 |
||
3 |
:organization: Logilab |
|
4212
ab6573088b4a
update copyright: welcome 2010
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
2996
diff
changeset
|
4 |
:copyright: 2008-2010 LOGILAB S.A. (Paris, FRANCE), license is LGPL v2. |
0 | 5 |
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr |
1977
606923dff11b
big bunch of copyright / docstring update
Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
parents:
1802
diff
changeset
|
6 |
:license: GNU Lesser General Public License, v2.1 - http://www.gnu.org/licenses |
0 | 7 |
""" |
8 |
__docformat__ = "restructuredtext en" |
|
9 |
||
10 |
from cubicweb.web.views.basecomponents import UserLink |
|
11 |
from cubicweb.web.views.actions import LogoutAction |
|
12 |
||
13 |
from google.appengine.api import users |
|
14 |
||
15 |
||
1398
5fe84a5f7035
rename internal entity types to have CW prefix instead of E
sylvain.thenault@logilab.fr
parents:
671
diff
changeset
|
16 |
class GACWUserLink(UserLink): |
0 | 17 |
|
18 |
def anon_user_link(self): |
|
19 |
self.w(self.req._('anonymous')) |
|
2996
866a2c135c33
B #345282 xhtml requires to use   instead of
Nicolas Chauvat <nicolas.chauvat@logilab.fr>
parents:
1977
diff
changeset
|
20 |
self.w(u' [<a class="logout" href="%s">%s</a>]' |
0 | 21 |
% (users.create_login_url(self.req.url()), self.req._('login'))) |
22 |
||
23 |
class GAELogoutAction(LogoutAction): |
|
24 |
||
25 |
def url(self): |
|
26 |
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
|
27 |
|
671 | 28 |
def registration_callback(vreg): |
29 |
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
|
30 |
vreg.register(GACWUserLink, clear=True) |
671 | 31 |
vreg.register(GAELogoutAction, clear=True) |