[ckan-changes] commit/ckan: John Glover: [logic] Do not check for authorization when listing all packages

Bitbucket commits-noreply at bitbucket.org
Tue Jul 26 10:53:14 UTC 2011


1 new changeset in ckan:

http://bitbucket.org/okfn/ckan/changeset/03b9eb25778a/
changeset:   03b9eb25778a
branch:      feature-1141-moderated-edits-ajax
user:        John Glover
date:        2011-07-26 12:52:40
summary:     [logic] Do not check for authorization when listing all packages
affected #:  1 file (99 bytes)

--- a/ckan/logic/action/get.py	Tue Jul 26 09:26:34 2011 +0100
+++ b/ckan/logic/action/get.py	Tue Jul 26 11:52:40 2011 +0100
@@ -1,5 +1,6 @@
 from sqlalchemy.sql import select
 from ckan.logic import NotFound, check_access
+from ckan.model import Session
 from ckan.plugins import (PluginImplementations,
                           IGroupController,
                           IPackageController)
@@ -20,7 +21,9 @@
     api = context["api_version"]
     ref_package_by = 'id' if api == '2' else 'name'
 
-    query = ckan.authz.Authorizer().authorized_query(user, model.Package)
+    query = Session.query(model.PackageRevision)
+    query = query.filter(model.PackageRevision.state=='active')
+    query = query.filter(model.PackageRevision.current==True)
     packages = query.all()
     return [getattr(p, ref_package_by) for p in packages]
 
@@ -29,7 +32,7 @@
     user = context["user"]
     limit = context.get("limit")
 
-    q = ckan.authz.Authorizer().authorized_query(user, model.PackageRevision)
+    q = Session.query(model.PackageRevision)
     q = q.filter(model.PackageRevision.state=='active')
     q = q.filter(model.PackageRevision.current==True)

Repository URL: https://bitbucket.org/okfn/ckan/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.




More information about the ckan-changes mailing list