Skip to content

Commit

Permalink
[#2939] Storage controller now uses file_upload auth function
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Oct 12, 2012
1 parent 2e51b56 commit 780ca23
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ckan/controllers/storage.py
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 780ca23

Please sign in to comment.