Skip to content

Commit

Permalink
Merge branch 'feature/package-sync-tracking' into staging
Browse files Browse the repository at this point in the history
# Conflicts:
#	ckanext/canada/auth.py
#	ckanext/canada/i18n/ckanext-canada.pot
#	ckanext/canada/tests/__init__.py
### RESOLVED.
  • Loading branch information
JVickery-TBS committed Oct 29, 2024
2 parents 39667a5 + 02cb676 commit da7d46b
Show file tree
Hide file tree
Showing 19 changed files with 1,094 additions and 287 deletions.
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 @@ -58,3 +59,21 @@ def recently_changed_packages_activity_list(context, data_dict):
Legacy, anyone can view.
"""
return {'success': True}


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

0 comments on commit da7d46b

Please sign in to comment.