fix auth to use new sysadmin flag

This commit is contained in:
kindly 2012-12-17 23:46:43 +00:00
parent d57e73458a
commit 596b9bb475
1 changed files with 2 additions and 4 deletions

View File

@ -1,13 +1,11 @@
import logging import logging
from sqlalchemy import or_, and_ from sqlalchemy import or_, and_
from ckan.authz import Authorizer
from ckan.model import User from ckan.model import User
import datetime import datetime
from ckan.plugins import PluginImplementations from ckan.plugins import PluginImplementations
from ckanext.harvest.interfaces import IHarvester from ckanext.harvest.interfaces import IHarvester
from ckan.logic import NotFound, check_access from ckan.logic import NotFound, check_access
from ckanext.harvest.model import (HarvestSource, HarvestJob, HarvestObject) from ckanext.harvest.model import (HarvestSource, HarvestJob, HarvestObject)
@ -168,13 +166,13 @@ def _get_sources_for_user(context,data_dict):
HarvestSource.next_run==None) HarvestSource.next_run==None)
) )
user_obj = User.get(user)
# Sysadmins will get all sources # 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 # This only applies to a non sysadmin user when using the
# publisher auth profile. When using the default profile, # publisher auth profile. When using the default profile,
# normal users will never arrive at this point, but even if they # normal users will never arrive at this point, but even if they
# do, they will get an empty list. # do, they will get an empty list.
user_obj = User.get(user)
publisher_filters = [] publisher_filters = []
publishers_for_the_user = user_obj.get_groups(u'publisher') publishers_for_the_user = user_obj.get_groups(u'publisher')