From f977025b05d6f65e0f3a8b5a0d56f4cb9ed209c7 Mon Sep 17 00:00:00 2001
From: Thorge Petersen <petersen@rz.uni-kiel.de>
Date: Mon, 6 Feb 2023 09:10:47 +0100
Subject: [PATCH] Removed OdshGroupController

---
 ckanext/odsh/controller.py | 46 --------------------------------------
 ckanext/odsh/plugin.py     |  3 ---
 2 files changed, 49 deletions(-)

diff --git a/ckanext/odsh/controller.py b/ckanext/odsh/controller.py
index cd31360d..dd68bdd3 100644
--- a/ckanext/odsh/controller.py
+++ b/ckanext/odsh/controller.py
@@ -28,52 +28,6 @@ render = base.render
 get_action = logic.get_action
 
 
-class OdshGroupController(OrganizationController):
-
-    def _action(self, name):
-
-        action = super(OdshGroupController, self)._action(name)
-
-        def custom_org_list(context, data_dict):
-            sort_desc = data_dict['sort'] == 'name desc'
-            d = data_dict.copy()
-            if 'offset' in d:
-                del d['offset']
-                del d['limit']
-            # print(data_dict)
-            if d["type"] != 'organization':
-                return action(context, d)
-            all = d['all_fields']
-            query = d['q']
-            result = action(context, d)
-            seen = set([(r['id'] if all else r) for r in result])
-            for q in query.split(' '):
-                d['q'] = q
-                ret = action(context, d)
-                for r in ret:
-                    id = r['id'] if all else r
-                    if id not in seen:
-                        result.append(r)
-                        seen.add(id)
-
-            if all:
-                result = sorted(
-                    result, key=lambda k: k['name'], reverse=sort_desc)
-            else:
-                result = sorted(result, reverse=sort_desc)
-            
-            if 'offset' in data_dict:
-                off = data_dict['offset']
-                limit = data_dict['limit']
-                return result[off:off+limit]
-            return result 
-
-        if name == 'group_list':
-            return custom_org_list
-        else:
-            return super(OdshGroupController, self)._action(name)
-
-
 class OdshApiController(ApiController):
     def action(self, logic_function, ver=None):
         if toolkit.asbool(config.get('ckanext.odsh.log_api_requests', 'false')):
diff --git a/ckanext/odsh/plugin.py b/ckanext/odsh/plugin.py
index 6eb9af09..3e7acd93 100644
--- a/ckanext/odsh/plugin.py
+++ b/ckanext/odsh/plugin.py
@@ -308,9 +308,6 @@ class OdshPlugin(plugins.SingletonPlugin, DefaultTranslation, DefaultDatasetForm
         with SubMapper(map, controller='ckanext.odsh.controller:OdshFeedController') as m:
             m.connect('/feeds/custom.atom', action='custom')
 
-        with SubMapper(map, controller='ckanext.odsh.controller:OdshGroupController') as m:
-            m.connect('organizations_index', '/organization', action='index')
-
         # redirect all user routes to custom controller
         # with SubMapper(map, controller='ckanext.odsh.controller:OdshUserController') as m:
         #     m.connect('/user/edit', action='edit')
-- 
GitLab