Skip to content

Commit

Permalink
[1669] Fix to the package show logic for deleted packages
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Feb 10, 2012
1 parent 61eab28 commit 73f2b02
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions ckan/logic/auth/publisher/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ def package_relationships_list(context, data_dict):
def package_show(context, data_dict):
""" Package show permission checks the user group if the state is deleted """
model = context['model']
user = context.get('user')
package = get_package_object(context, data_dict)
userobj = model.User.get( user )

if not userobj:
return {'success': False, 'msg': _('User %s not authorized to read package %s') % (str(user),package.id)}

if package.state == 'deleted':
user = context.get('user')

if not user:
return {'success': False, 'msg': _('User not authorized to read package %s') % (package.id)}

userobj = model.User.get( user )
if not userobj:
return {'success': False, 'msg': _('User %s not authorized to read package %s') % (str(user),package.id)}

if not _groups_intersect( userobj.get_groups('publisher'), package.get_groups('publisher') ):
return {'success': False, 'msg': _('User %s not authorized to read package %s') % (str(user),package.id)}

Expand Down

0 comments on commit 73f2b02

Please sign in to comment.