From 780ca23df9cad249c45ec18db07c594d484f45c6 Mon Sep 17 00:00:00 2001 From: tobes Date: Fri, 12 Oct 2012 10:06:51 +0100 Subject: [PATCH] [#2939] Storage controller now uses file_upload auth function --- ckan/controllers/storage.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ckan/controllers/storage.py b/ckan/controllers/storage.py index cfee8bd3d78..7fa0d8868bd 100644 --- a/ckan/controllers/storage.py +++ b/ckan/controllers/storage.py @@ -15,7 +15,7 @@ from ckan.lib.base import BaseController, c, request, render, config, h, abort from ckan.lib.jsonp import jsonpify import ckan.model as model -import ckan.authz as authz +import ckan.new_authz as new_authz try: from cStringIO import StringIO @@ -95,10 +95,9 @@ def authorize(method, bucket, key, user, ofs): if ofs.exists(bucket, key): abort(409) # now check user stuff - username = user.name if user else '' - is_authorized = authz.Authorizer.is_authorized(username, - 'file-upload', - model.System()) + context = {'user': c.user, + 'model': model} + is_authorized = new_authz.is_authorized_boolean('file_upload', context, {}) if not is_authorized: h.flash_error('Not authorized to upload files.') abort(401)