[ckan-changes] commit/ckanext-datano: sebbacon: call difi's logout API

Bitbucket commits-noreply at bitbucket.org
Fri Jun 10 15:28:48 UTC 2011


1 new changeset in ckanext-datano:

http://bitbucket.org/okfn/ckanext-datano/changeset/146ee7c26652/
changeset:   146ee7c26652
user:        sebbacon
date:        2011-06-10 17:28:41
summary:     call difi's logout API
affected #:  1 file (596 bytes)

--- a/ckanext/datano/plugin.py	Thu Jun 09 15:09:18 2011 +0100
+++ b/ckanext/datano/plugin.py	Fri Jun 10 16:28:41 2011 +0100
@@ -1,10 +1,12 @@
 import os
 from logging import getLogger
+import urllib2
 
 from pylons import c
 from ckan import model
 from ckan.plugins import implements, SingletonPlugin
-from ckan.plugins import IConfigurer, IPackageController
+from ckan.plugins import IConfigurer, IPackageController, IRoutes
+from ckan.controllers.user import UserController
 
 log = getLogger(__name__)
 
@@ -12,7 +14,8 @@
 class DataNOPlugin(SingletonPlugin):
     implements(IConfigurer, inherit=True)
     implements(IPackageController, inherit=True)
-
+    implements(IRoutes, inherit=True)
+    
     def update_config(self, config):
         here = os.path.dirname(__file__)
         rootdir = os.path.dirname(os.path.dirname(here))
@@ -39,3 +42,17 @@
         if authzgroup:
             role = "editor"
             model.add_authorization_group_to_role(authzgroup, role, package)
+
+    def before_map(self, map):
+        map.connect('logged_out',
+                    '/user/logged_out',
+                    controller='ckanext.datano.plugin:CustomUserController',
+                    action='custom_logged_out')
+        return map
+
+
+class CustomUserController(UserController):
+    def custom_logged_out(self):
+        logout_url = "https://mi.difi.no/?logout=393ca412-6233-475a-a229-002c3349"
+        urllib2.urlopen(logout_url)
+        return self.logged_out()

Repository URL: https://bitbucket.org/okfn/ckanext-datano/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list