Skip to content
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you set max_strikes then users can 'report' a comment as spam/abuse. If the n

By default, issues are enabled for all datasets. If you wish to restrict
issues to specific datasets or organizations, you can use these config options:

ckanext.issues.enabled_for_datasets = mydataset1 mydataset2 ...
ckanext.issues.enabled_for_organizations = department-of-transport health-regulator

Expand All @@ -91,7 +91,7 @@ and you can set the default for all the other datasets (without that extra field

ckanext.issues.enabled_without_extra = false

For the extra field to work you must not set `enabled_per_dataset` or `enabled_for_organizations` options.
For the extra field to work you must not set `enabled_for_datasets` or `enabled_for_organizations` options.

## Feedback

Expand Down
21 changes: 10 additions & 11 deletions ckanext/issues/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import ckan.plugins as p
from ckanext.issues import model as issue_model

_ = p.toolkit._


def issue_auth(context, data_dict, privilege='package_update'):
'''Returns whether the current user is allowed to do the action
Expand All @@ -15,12 +17,11 @@ def issue_auth(context, data_dict, privilege='package_update'):
except p.toolkit.NotAuthorized:
return {
'success': False,
'msg': p.toolkit._(
'User {0} not authorized for action on issue {1}'.format(
str(context['user']),
auth_data_dict['id']
)
)
'msg': _(
'User {user} not authorized for action on issue {issue}'
).format(
user=str(context['user']),
issue=auth_data_dict['id'])
}


Expand All @@ -37,10 +38,8 @@ def issue_search(context, data_dict):
except p.toolkit.NotAuthorized:
return {
'success': False,
'msg': p.toolkit._(
'User {0} not authorized for action'.format(
str(context['user'])
)
'msg': _('User {0} not authorized for action').format(
str(context['user'])
)
}

Expand Down Expand Up @@ -86,7 +85,7 @@ def issue_update(context, data_dict):
# all other cases not allowed
return {
'success': False,
'msg': p.toolkit._(
'msg': _(
'User {user} not authorized for action on issue {issue}'.format(
user=str(user),
issue=data_dict['issue_number'])
Expand Down