Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PortalUpdater Improvements and PackageSync Model #1522

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/1522.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added `PackageSync` model for the `package_sync` table which tracks the PortalUpdater process and saves the states for the packages.
25 changes: 22 additions & 3 deletions ckanext/canada/auth.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from ckan.plugins.toolkit import chained_auth_function, config
from ckan.authz import has_user_permission_for_group_or_org, is_sysadmin
from ckan.plugins import plugin_loaded


def _is_reporting_user(context):
Expand All @@ -10,19 +11,19 @@ def _is_reporting_user(context):
# block datastore-modifying APIs on the portal
@chained_auth_function
def datastore_create(up_func, context, data_dict):
if 'canada_internal' not in config.get('ckan.plugins'):
if not plugin_loaded('canada_internal'):
return {'success': False}
return up_func(context, data_dict)

@chained_auth_function
def datastore_delete(up_func, context, data_dict):
if 'canada_internal' not in config.get('ckan.plugins'):
if not plugin_loaded('canada_internal'):
return {'success': False}
return up_func(context, data_dict)

@chained_auth_function
def datastore_upsert(up_func, context, data_dict):
if 'canada_internal' not in config.get('ckan.plugins'):
if not plugin_loaded('canada_internal'):
return {'success': False}
return up_func(context, data_dict)

Expand Down Expand Up @@ -51,3 +52,21 @@ def organization_list(context, data_dict):

def organization_show(context, data_dict):
return {'success': bool(context.get('user'))}


def portal_sync_info(context, data_dict):
"""
Registry users have to be logged in.

Anyone on public Portal can access.
"""
if plugin_loaded('canada_internal'):
return {'success': bool(context.get('user'))}
return {'success': True}


def list_out_of_sync_packages(context, data_dict):
"""
Only sysadmins can list the out of sync packages.
"""
return {'success': False}
397 changes: 304 additions & 93 deletions ckanext/canada/cli.py

Large diffs are not rendered by default.

Loading
Loading