From 596b9bb4759e554576e5ce7bfd468d886ac143fd Mon Sep 17 00:00:00 2001 From: kindly Date: Mon, 17 Dec 2012 23:46:43 +0000 Subject: [PATCH] fix auth to use new sysadmin flag --- ckanext/harvest/logic/action/get.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ckanext/harvest/logic/action/get.py b/ckanext/harvest/logic/action/get.py index 11e838d..1b39c5c 100644 --- a/ckanext/harvest/logic/action/get.py +++ b/ckanext/harvest/logic/action/get.py @@ -1,13 +1,11 @@ import logging from sqlalchemy import or_, and_ -from ckan.authz import Authorizer from ckan.model import User import datetime from ckan.plugins import PluginImplementations from ckanext.harvest.interfaces import IHarvester - from ckan.logic import NotFound, check_access from ckanext.harvest.model import (HarvestSource, HarvestJob, HarvestObject) @@ -168,13 +166,13 @@ def _get_sources_for_user(context,data_dict): HarvestSource.next_run==None) ) + user_obj = User.get(user) # Sysadmins will get all sources - if not Authorizer().is_sysadmin(user): + if user_obj and user_obj.sysadmin: # This only applies to a non sysadmin user when using the # publisher auth profile. When using the default profile, # normal users will never arrive at this point, but even if they # do, they will get an empty list. - user_obj = User.get(user) publisher_filters = [] publishers_for_the_user = user_obj.get_groups(u'publisher')