def after_map(self, sub_map): from ckan.config.routing import SubMapper with SubMapper(sub_map, controller='ckanext.forum.controllers:ForumAdminController') as m: m.connect('forum_banned_users', '/forum/admin/banned_users', action='index_banned_user') m.connect('forum_unban_user', '/forum/admin/unban_user/:user_id', action='unban_user') with SubMapper(sub_map, controller='ckanext.forum.controllers:ForumController') as m: m.connect('forum_activity1', '/forum/ban', action='index_banned_user') m.connect('forum_index', '/forum', action='index', highlight_actions='index thread_add board_add activity board_show thread_show') m.connect('forum_thread_add', '/forum/thread_add', action='thread_add') m.connect('forum_board_add', '/forum/board_add', action='board_add') m.connect('forum_unsubscribe', '/forum/unsubscribe/:base64_name/:thread_id', action='unsubscribe') m.connect('forum_activity', '/forum/activity', action='activity') m.connect('forum_thread_ban', '/forum/thread_ban/:id', action='thread_ban') m.connect('forum_post_ban', '/forum/post_ban/:id', action='post_ban') m.connect('forum_board_hide', '/forum/:slug/hide', action='board_hide') m.connect('forum_board_unhide', '/forum/:slug/unhide', action='board_unhide') m.connect('forum_board_show', '/forum/:slug', action='board_show') m.connect('forum_thread_show', '/forum/:slug/:id', action='thread_show') # with SubMapper(sub_map, controller='ckanext.forum.admin.controllers:ForumAdminController') as m: # m.connect('banned_users', '/forum/banned_users', action='index_banned_user') # m.connect('unban_user', '/forum/admin/unban_user/:id', action='unban_user') return sub_map
def before_map(self, map): """ Make "/data" the homepage. """ data_controller = 'ckanext.dgu.controllers.data:DataController' user_controller = 'ckanext.dgu.controllers.user:UserController' map.redirect('/data', '/data/search') #map.connect('/data', controller=data_controller, action='index') map.connect('/linked-data-admin', controller=data_controller, action='linked_data_admin') map.connect('dgu_search', '/data/search', controller='package', action='search') map.connect('api_page', '/data/metadata-api-docs', controller=data_controller, action='api') map.connect('system_dashboard', '/data/system_dashboard', controller=data_controller, action='system_dashboard') map.connect('openspending_index', '/data/openspending-report/index', controller=data_controller, action='openspending_report') map.connect('openspending_read', '/data/openspending-report/{id}', controller=data_controller, action='openspending_publisher_report') map.connect('/data/resource_cache/{root}/{resource_id}/{filename}', controller=data_controller, action='resource_cache') map.connect('/data/viz/social-investment-and-foundations', controller=data_controller, action='viz_social_investment_and_foundations') map.connect('/data/viz/investment-readiness-programme', controller=data_controller, action='viz_investment_readiness_programme') map.connect('/data/viz/upload', controller=data_controller, action='viz_upload') map.connect('/', controller=data_controller, action='home') map.connect('/data/contracts-finder-archive{relative_url:.*}', controller=data_controller, action='contracts_archive') theme_controller = 'ckanext.dgu.controllers.theme:ThemeController' map.connect('/data/themes', controller=theme_controller, action='index') map.connect('/data/themes/{name}', controller=theme_controller, action='named_theme') map.connect('/data/random-datasets', controller=data_controller, action='random_datasets') # For test usage when Drupal is not running map.connect('/comment/get/{id}', controller='ckanext.dgu.controllers.package:CommentProxy', action='get_comments') # Remap the /user/me to the DGU version of the User controller with SubMapper(map, controller=user_controller) as m: m.connect('/data/user/me', action='me') # Map /user* to /data/user/ because Drupal uses /user with SubMapper(map, controller='user') as m: m.connect('/data/user/edit', action='edit') m.connect('/data/user/edit/{id:.*}', action='edit') m.connect('/data/user/reset/{id:.*}', action='perform_reset') m.connect('/data/user/register', action='register') m.connect('/data/user/login', action='login') m.connect('/data/user/_logout', action='logout') m.connect('/data/user/logged_in', action='logged_in') m.connect('/data/user/logged_out', action='logged_out') m.connect('/data/user/logged_out_redirect', action='logged_out_page') m.connect('/data/user/reset', action='request_reset') #NB not /data/user/me m.connect('/data/user/set_lang/{lang}', action='set_lang') m.connect('user_read', '/data/user/{id:.*}', action='read') m.connect('/data/user', action='index') map.redirect('/dashboard', '/data/user/me') return map
def after_map(self, routes): with SubMapper( routes, controller='ckanext.defra.controllers.dataset:DatasetController' ) as m: m.connect('dataset_more', '/dataset/{dataset_id}/more', action='more') m.connect('dataset_issues', '/dataset/{dataset_id}/issues', action='issues') controller = 'ckanext.defra.controllers.publisher:PublisherController' with SubMapper(routes, controller=controller) as m: m.connect('publishers_index', '/publisher', action='index') m.connect('publisher_index', '/publisher', action='index') m.connect('publisher_new', '/publisher/new', action='new') for action in [ 'delete', 'admins', 'member_new', 'member_delete', 'history' ]: m.connect('publisher_' + action, '/publisher/' + action + '/{id}', action=action) m.connect('publisher_activity', '/publisher/activity/{id}/{offset}', action='activity') m.connect('publisher_read', '/publisher/{id}', action='read') m.connect('publisher_about', '/publisher/about/{id}', action='about') m.connect('publisher_read', '/publisher/{id}', action='read', ckan_icon='sitemap') m.connect('publisher_edit', '/publisher/edit/{id}', action='edit') m.connect('publisher_members', '/publisher/members/{id}', action='members') m.connect('publisher_bulk_process', '/publisher/bulk_process/{id}', action='bulk_process') with SubMapper( routes, controller='ckanext.defra.controllers.search:SearchController' ) as m: m.connect('search_autocomplete', '/search/autocomplete', action='autocomplete') return routes
def before_map(self, map): # Default mappings copied from ckan/config/routing.py that we want to preserve. with SubMapper(map, controller='package') as m: m.connect('/dataset/{action}', requirements=dict(action='|'.join( ['list', 'new', 'autocomplete', 'search']))) m.connect('/dataset/{action}/{id}/{revision}', action='read_ajax', requirements=dict(action='|'.join([ 'read', 'edit', 'authz', 'history', ]))) m.connect('/dataset/{action}/{id}', requirements=dict(action='|'.join([ 'edit', 'editresources', 'authz', 'history', 'read_ajax', 'history_ajax', ]))) m.connect('/dataset/{id}.{format}', action='read') m.connect('/dataset/{id}/resource/{resource_id}', action='resource_read') # Our new custom mapping. map.connect( '/dataset/{id}', controller= 'ckanext.dadosgovbr.controllers.package:DadosGovBrDatasetController', action='read') return map
def before_map(self, map): map.redirect('/organization/{url:.*}', '/publisher/{url}') with SubMapper(map, controller='ckanext.dgu.controllers.publisher:PublisherController') as m: m.connect('publisher_index', '/publisher', action='index') m.connect('publisher_edit', '/publisher/edit/:id', action='edit') m.connect('publisher_apply', '/publisher/apply/:id', action='apply') m.connect('publisher_apply_empty', '/publisher/apply', action='apply') m.connect('publisher_requests', '/publisher/users/requests', action='publisher_requests') m.connect('publisher_request', '/publisher/users/request/:token', action='publisher_request') m.connect('publisher_request_decision', '/publisher/users/request/:token/:decision', action='publisher_request') m.connect('publisher_users', '/publisher/users/:id', action='users') m.connect('publisher_new', '/publisher/new', action='new') m.connect('/publisher/report_groups_without_admins', action='report_groups_without_admins') m.connect('/publisher/report_publishers_and_users', action='report_publishers_and_users') m.connect('/publisher/report_users', action='report_users') m.connect('/publisher/report_users_not_assigned_to_groups', action='report_users_not_assigned_to_groups') m.connect('publisher_read', '/publisher/:id', action='read') return map
def after_map(self, sub_map): from ckan.config.routing import SubMapper with SubMapper( sub_map, controller='ckanext.apps.controllers:AppsController') as m: m.connect('apps_index', '/apps', action='index', highlight_actions= 'index show_app app_add board_add activity board_show') m.connect('apps_app_show', '/apps/show/:id', action='show_app') m.connect('apps_app_edit', '/apps/edit/:id', action='edit_app') m.connect('apps_app_delete', '/apps/delete/:id', action='delete_app') m.connect('apps_app_add', '/apps/add', action='app_add') m.connect('apps_board_add', '/apps/board_add', action='board_add') m.connect('apps_activity', '/apps/activity', action='activity') m.connect('apps_board_unhide', '/apps/:slug/unhide', action='board_unhide') m.connect('apps_board_hide', '/apps/:slug/hide', action='board_hide') m.connect('apps_board_show', '/apps/:slug', action='board_show') m.connect('apps_close_app', '/apps/:id/close', action='close_app') m.connect('apps_change_status', '/apps/:id/:status', action='change_app_status') m.connect('apps_app_set_mark', '/apps/mark/:id/:rate', action='set_mark') return sub_map
def before_map(self, map): map.redirect('/organization/{url:.*}', '/organisation/{url}') with SubMapper(map, controller='ckanext.dgu_orgs.controllers.organisation:OrganisationController') as m: m.connect('organisation_index', '/organisation', action='index') m.connect('organisation_edit', '/organisation/edit/:id', action='edit') m.connect('organisation_apply', '/organisation/apply/:id', action='apply') m.connect('organisation_apply_empty', '/organisation/apply', action='apply') m.connect('organisation_requests', '/organisation/users/requests', action='organisation_requests') m.connect('organisation_request', '/organisation/users/request/:token', action='organisation_request') m.connect('organisation_request_decision', '/organisation/users/request/:token/:decision', action='organisation_request') m.connect('organisation_users', '/organisation/users/:id', action='users') m.connect('organisation_new', '/organisation/new', action='new') m.connect('/organisation/report_groups_without_admins', action='report_groups_without_admins') m.connect('/organisation/report_organisations_and_users', action='report_organisations_and_users') m.connect('/organisation/report_users', action='report_users') m.connect('/organisation/report_users_not_assigned_to_groups', action='report_users_not_assigned_to_groups') m.connect('organisation_read', '/organisation/:id', action='read') return map
def before_map(self, map): organization_controller = 'ckanext.ytp.organizations.controller:YtpOrganizationController' with SubMapper(map, controller=organization_controller) as m: m.connect('organization_members', '/organization/members/{id}', action='members', ckan_icon='group') m.connect('/user_list', action='user_list', ckan_icon='user') m.connect('/admin_list', action='admin_list', ckan_icon='user') map.connect('/organization/new', action='new', controller='organization') map.connect('organization_read', '/organization/{id}', controller=organization_controller, action='read', ckan_icon='group') map.connect('organization_embed', '/organization/{id}/embed', controller=organization_controller, action='embed', ckan_icon='group') return map
def before_map(self, sub_map): from ckan.config.routing import SubMapper with SubMapper( sub_map, controller='ckanext.files.controllers:FilesController') as m: m.connect('files_index', '/files', action='index') return sub_map
def before_map(self, map): from ckan.config.routing import SubMapper with SubMapper(map, controller='ckanext.issues.controller:IssueController') as m: m.connect('issues_home', '/dataset/:package_id/issues', action='home', ckan_icon='warning-sign') m.connect('issues_new', '/dataset/:package_id/issues/new', action='new') m.connect('issues_edit', '/dataset/:package_id/issues/:id/edit', action='edit') m.connect('issues_delete', '/dataset/:dataset_id/issues/:issue_id/delete', action='delete') m.connect('issues_assign', '/dataset/:dataset_id/issues/:issue_id/assign', action='assign') m.connect('issues_comments', '/dataset/:package_id/issues/:id/comments', action='comments') m.connect('issues_report_abuse', '/dataset/:dataset_id/issues/:issue_id/report_abuse', action='report_abuse'), m.connect('issues_reset_spam_state', '/dataset/:dataset_id/issues/:issue_id/reset_spam_state', action='reset_spam_state'), m.connect('issues_comment_report_abuse', '/dataset/:dataset_id/issues/:issue_id/comment/:comment_id/report_abuse', action='report_comment_abuse'), m.connect('issues_comment_reset_spam_state', '/dataset/:dataset_id/issues/:issue_id/comment/:comment_id/reset_spam_state', action='reset_comment_spam_state'), m.connect('add_issue_with_resource', '/dataset/:package_id/issues/new/:resource_id', action='add') m.connect('issues_show', '/dataset/:package_id/issues/:id', action='show') # Broken: m.connect('all_issues_page', '/issues', action='all_issues_page') m.connect('publisher_issue_page', '/publisher/issues/:publisher_id', action='publisher_issue_page') return map
def before_map(self, map): # Remap user edit to our user controller user_controller = 'ckanext.ytp.user.controller:YtpUserController' with SubMapper(map, controller=user_controller) as m: m.connect('/user/edit', action='edit') m.connect('/user/edit/{id:.*}', action='edit') m.connect('/user/me', action='me') #m.connect('/user/{id}', action='read') return map
def after_map(self, map): if is_plugin_enabled('issues'): delete_routes_by_name(map, 'issues_for_organization') with SubMapper( map, controller='ckanext.issues.controller:IssueController' ) as m: m.connect('issues_for_organization', '/publisher/:org_id/issues', action='issues_for_organization') return map
def before_map(self, map): """ Make "/data" the homepage. """ data_controller = 'ckanext.dgu.controllers.data:DataController' tag_controller = 'ckanext.dgu.controllers.tag:TagController' map.redirect('/', '/data') map.connect('/data', controller=data_controller, action='index') map.connect('/data/tag', controller=tag_controller, action='index') map.connect('/data/tag/{id}', controller=tag_controller, action='read') map.connect('/data/search', controller='package', action='search') map.connect('/data/api', controller=data_controller, action='api') map.connect('/data/system_dashboard', controller=data_controller, action='system_dashboard') map.connect('/data/openspending-browse', controller=data_controller, action='openspending_browse') map.connect('/data/openspending-report/index', controller=data_controller, action='openspending_report') map.connect('/data/openspending-report/{id}', controller=data_controller, action='openspending_publisher_report') map.connect('/data/openspending-report/{id}', controller=data_controller, action='openspending_publisher_report') map.connect('/data/carparks', controller=data_controller, action='carparks') # For test usage when Drupal is not running map.connect('/comment/get/{id}', controller='ckanext.dgu.controllers.package:CommentProxy', action='get_comments') # Map /user* to /data/user/ because Drupal uses /user with SubMapper(map, controller='user') as m: m.connect('/data/user/edit', action='edit') m.connect('/data/user/edit/{id:.*}', action='edit') m.connect('/data/user/reset/{id:.*}', action='perform_reset') m.connect('/data/user/register', action='register') m.connect('/data/user/login', action='login') m.connect('/data/user/_logout', action='logout') m.connect('/data/user/logged_in', action='logged_in') m.connect('/data/user/logged_out', action='logged_out') m.connect('/data/user/logged_out_redirect', action='logged_out_page') m.connect('/data/user/reset', action='request_reset') m.connect('/data/user/me', action='me') m.connect('/data/user/set_lang/{lang}', action='set_lang') m.connect('/data/user/{id:.*}', action='read') m.connect('/data/user', action='index') return map
def after_map(self, route_map): # Deletes all the organization routes delete_routes_by_path_startswith(route_map, '/organization') harvest_org_controller = 'ckanext.harvest.controllers.organization:OrganizationController' route_map.connect('harvest_org_list', '/publisher/harvest/' + '{id}', controller=harvest_org_controller, action='source_list') # add this function in OrganizationController as CKAN doesn't have 'publisher' group type def _guess_group_type(self, expecting_name=False): return 'organization' from ckan.controllers.organization import OrganizationController OrganizationController._guess_group_type = _guess_group_type # Recreates the organization routes with /publisher instead. with SubMapper(route_map, controller='organization') as m: m.connect('organizations_index', '/publisher', action='index') m.connect('organization_index', '/publisher', action='index') m.connect('organization_new', '/publisher/new', action='new') for action in [ 'delete', 'admins', 'member_new', 'member_delete', 'history' ]: m.connect('organization_' + action, '/publisher/' + action + '/{id}', action=action) m.connect('organization_activity', '/publisher/activity/{id}/{offset}', action='activity') m.connect('organization_read', '/publisher/{id}', action='read') m.connect('organization_about', '/publisher/about/{id}', action='about') m.connect('organization_read', '/publisher/{id}', action='read', ckan_icon='sitemap') m.connect('organization_edit', '/publisher/edit/{id}', action='edit') m.connect('organization_members', '/publisher/members/{id}', action='members') m.connect('organization_bulk_process', '/publisher/bulk_process/{id}', action='bulk_process') route_map.connect('harvest_index', '/harvest', action='index') return route_map
def before_map(self, map): controller = 'ckanext.cadastaroles.controller:CadastaAdminController' with SubMapper(map, controller=controller) as m: m.connect('cadasta_admins', '/ckan-admin/cadasta_admins', action='manage', ckan_icon='user') m.connect('cadasta_admin_remove', '/ckan-admin/cadasta_admin_remove', action='remove') return map
def before_map(self, map): controller = 'ckanext.ab_security.controllers:SecurityClassificationController' with SubMapper(map, controller=controller) as m: m.connect('security_members', '/organization/{id}/security_members', action='manage', ckan_icon='user') m.connect('security_members_remove', '/organization/{id}/security_members_remove', action='remove') return map
def before_map(self, map): user_ctrl = 'ckanext.gdpr.controller:GdprUserController' with SubMapper(map, controller=user_ctrl) as m: m.connect('user_index', '/user', action='index') m.connect('request_reset', '/user/reset', action='request_reset') m.connect('/user/reset/{id:.*}', action='perform_reset') m.connect('/user/activity/{id}/{offset}', action='activity') m.connect('user_activity_stream', '/user/activity/{id}', action='activity', ckan_icon='time') return map
def after_map(self, route_map): # Deletes all the organization routes delete_routes_by_path_startswith(route_map, '/organization') harvest_org_controller = 'ckanext.harvest.controllers.organization:OrganizationController' route_map.connect('harvest_org_list', '/publisher/harvest/' + '{id}', controller=harvest_org_controller, action='source_list') # Recreates the organization routes with /publisher instead. with SubMapper(route_map, controller='organization') as m: m.connect('organizations_index', '/publisher', action='index') m.connect('organization_index', '/publisher', action='index') m.connect('organization_new', '/publisher/new', action='new') for action in [ 'delete', 'admins', 'member_new', 'member_delete', 'history' ]: m.connect('organization_' + action, '/publisher/' + action + '/{id}', action=action) m.connect('organization_activity', '/publisher/activity/{id}/{offset}', action='activity') m.connect('organization_read', '/publisher/{id}', action='read') m.connect('organization_about', '/publisher/about/{id}', action='about') m.connect('organization_read', '/publisher/{id}', action='read', ckan_icon='sitemap') m.connect('organization_edit', '/publisher/edit/{id}', action='edit') m.connect('organization_members', '/publisher/members/{id}', action='members') m.connect('organization_bulk_process', '/publisher/bulk_process/{id}', action='bulk_process') route_map.connect('harvest_index', '/harvest', action='index') return route_map
def before_map(self, route_map): user_controller = 'ckanext.datagovuk.controllers.user:UserController' healthcheck_controller = 'ckanext.datagovuk.controllers.healthcheck:HealthcheckController' api_search_dataset_controller = 'ckanext.datagovuk.controllers.api:DGUApiController' with SubMapper(route_map, controller=user_controller) as m: m.connect('register', '/user/register', action='register') m.connect('/user/logged_in', action='logged_in') m.connect('/user/edit', action='edit') m.connect('/user/edit/{id:.*}', action='edit') m.connect('/user/reset', action='request_reset') route_map.connect('healthcheck', '/healthcheck', controller=healthcheck_controller, action='healthcheck') route_map.connect('/api/search/dataset', controller=api_search_dataset_controller, action='api_search_dataset') route_map.redirect('/home', '/') return route_map
def before_map(self, map): user_ctrl = 'ckanext.opnv.controller:OpnvUserController' map.redirect('/user/register', '/user/login') with SubMapper(map, controller=user_ctrl) as m: m.connect('register', '/user/_register_partner', action='register') return map
def before_map(self, map): from ckan.config.routing import SubMapper controller_name = 'ckanext.issues.controller:IssueController' with SubMapper(map, controller=controller_name) as m: m.connect('issues_dataset', '/dataset/:dataset_id/issues', action='dataset', ckan_icon='warning-sign') m.connect('issues_new', '/dataset/:dataset_id/issues/new', action='new') m.connect('issues_edit', '/dataset/:dataset_id/issues/:issue_number/edit', action='edit') m.connect('issues_delete', '/dataset/:dataset_id/issues/:issue_number/delete', action='delete') m.connect('issues_assign', '/dataset/:dataset_id/issues/:issue_number/assign', action='assign') m.connect('issues_comments', '/dataset/:dataset_id/issues/:issue_number/comments', action='comments') m.connect('issues_report', '/dataset/:dataset_id/issues/:issue_number/report', action='report'), m.connect('issues_report_clear', '/dataset/:dataset_id/issues/:issue_number/report_clear', action='report_clear'), m.connect('issues_comment_report', '/dataset/:dataset_id/issues/:issue_number/comment/:comment_id/report', action='report_comment'), m.connect('issues_comment_report_clear', '/dataset/:dataset_id/issues/:issue_number/comment/:comment_id/report_clear', action='comment_report_clear'), m.connect('add_issue_with_resource', '/dataset/:dataset_id/issues/new/:resource_id', action='add') m.connect('issues_show', '/dataset/:dataset_id/issues/:issue_number', action='show') m.connect('all_issues_page', '/issues', action='all_issues_page') m.connect('issues_for_organization', '/organization/:org_id/issues', action='issues_for_organization') moderation = 'ckanext.issues.controller:ModerationController' with SubMapper(map, controller=moderation) as m: m.connect('issues_moderate_reported_issues', '/organization/:organization_id/issues/reported', action='all_reported_issues') m.connect('issues_moderate', '/organization/:organization_id/issues/moderate', action='moderate') moderation = 'ckanext.issues.controller:CommentModerationController' with SubMapper(map, controller=moderation) as m: m.connect('issues_moderate_reported_comments', '/organization/:organization_id/issues/reported_comments', action='reported_comments') m.connect('issues_moderate_comment', '/organization/:organization_id/issues/moderate_comment', action='moderate') return map