ckan/ckanext-showcase

unable to access showcases page if a showcase has a private dataset

Closed this issue · 1 comments

If user1 creates a showcase that contains a dataset that is private to their organization then user2 that doesn't belong to that organization tries to access the showcases page they receive an error and the page doesn't load. Below is the output that is emailed to me (the CKAN admin).

Ideally I think user 2 should still be able to see other showcases or see the existing showcases but not see those linked private datasets.

WebApp Error: <class 'ckan.logic.NotAuthorized'>: User aca2_user not authorized to read package 179e91f3-2e67-4b4d-bbe3-36c545364cb4
Module ckan.controllers.package:268 in search

query = get_action('package_search')(context, data_dict)
Module ckan.logic:416 in wrapped
result = _action(context, data_dict, *_kw)
Module ckan.logic.action.get:1958 in package_search
package_dict = item.before_view(package_dict)
Module ckanext.showcase.plugin:242 in before_view
return self._add_to_pkg_dict(context, pkg_dict)
Module ckanext.showcase.plugin:221 in _add_to_pkg_dict
context, {'showcase_id': pkg_dict['id']}))
Module ckan.logic:416 in wrapped
result = _action(context, data_dict, *_kw)
Module ckan.logic:532 in wrapper
return action(context, data_dict)
Module ckanext.showcase.logic.action.get:81 in showcase_package_list
pkg = toolkit.get_action('package_show')(context, {'id': pkg_id})
Module ckan.logic:416 in wrapped
result = _action(context, data_dict, _kw)
Module ckan.logic.action.get:1030 in package_show
check_access('package_show', context, data_dict)
Module ckan.logic:286 in check_access
raise NotAuthorized(msg)
NotAuthorized: User aca2_user not authorized to read package 179e91f3-2e67-4b4d-bbe3-36c545364cb4
CGI Variables
AUTH_TYPE 'cookie'
CKAN_CURRENT_URL '/showcase'
CKAN_LANG 'en'
CKAN_LANG_IS_DEFAULT True
CONTENT_TYPE '; charset=utf-8'
CONTEXT_DOCUMENT_ROOT '/var/www'
DOCUMENT_ROOT '/var/www'
GATEWAY_INTERFACE 'CGI/1.1'
HTTP_ACCEPT 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,
/
;q=0.8'
HTTP_ACCEPT_ENCODING 'gzip, deflate, sdch'
HTTP_ACCEPT_LANGUAGE 'en-US,en;q=0.8'
HTTP_CONNECTION 'close'
HTTP_COOKIE '_sm_au=aaaaaaaaaaaaaaaaaaaa; auth_tkt="91d7dd51be4fca295a9b80f498bcaf4b578532d1aca2_user!userid_type:unicode"; auth_tkt="91d7dd51be4fca295a9b80f498bcaf4b578532d1aca2_user!userid_type:unicode"'
HTTP_HOST 'ec2-54-197-20-196.compute-1.amazonaws.com'
HTTP_REFERER 'http://ec2-54-197-20-196.compute-1.amazonaws.com/dashboard'
HTTP_UPGRADE_INSECURE_REQUESTS '1'
HTTP_USER_AGENT 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.84 Safari/537.36'
HTTP_XROXY_CONNECTION 'keep-alive'
HTTP_X_FORWARDED_FOR '206.209.225.80'
PATH_INFO '/showcase'
PATH_TRANSLATED '/etc/ckan/default/apache.wsgi/showcase'
REMOTE_ADDR '127.0.0.1'
REMOTE_PORT '53510'
REMOTE_USER u'aca2_user'
REMOTE_USER_DATA 'userid_type:unicode'
REMOTE_USER_TOKENS ['']
REQUEST_METHOD 'GET'
REQUEST_SCHEME 'http'
REQUEST_URI '/showcase'
SCRIPT_FILENAME '/etc/ckan/default/apache.wsgi'
SERVER_ADDR '127.0.0.1'
SERVER_ADMIN '[no address given]'
SERVER_NAME 'ec2-54-197-20-196.compute-1.amazonaws.com'
SERVER_PORT '80'
SERVER_PROTOCOL 'HTTP/1.0'
SERVER_SIGNATURE '

Apache/2.4.7 (Ubuntu) Server at ec2-54-197-20-196.compute-1.amazonaws.com Port 80\n'
SERVER_SOFTWARE 'Apache/2.4.7 (Ubuntu)'
WSGI Variables
application <fanstatic.publisher.Delegator object at 0x7fe45639d710>
beaker.cache <beaker.cache.CacheManager object at 0x7fe45639d790>
beaker.get_session <bound method SessionMiddleware._get_session of <beaker.middleware.SessionMiddleware object at 0x7fe45638b850>>
beaker.session {'_accessed_time': 1468347098.571599, '_creation_time': 1468347098.571599}
fanstatic.needed <fanstatic.core.NeededResources object at 0x7fe44cd4e450>
mod_wsgi.application_group 'default.ckanhosted.com|'
mod_wsgi.callable_object 'application'
mod_wsgi.enable_sendfile '0'
mod_wsgi.handler_script ''
mod_wsgi.input_chunked '0'
mod_wsgi.listener_host ''
mod_wsgi.listener_port '8080'
mod_wsgi.process_group 'ckan_default'
mod_wsgi.queue_start '1468347098531759'
mod_wsgi.request_handler 'wsgi-script'
mod_wsgi.script_reloading '1'
mod_wsgi.version (3, 4)
paste.cookies (<SimpleCookie: _sm_au='aaaaaaaaaaaaaaaaaaaa' auth_tkt='91d7dd51be4fca295a9b80f498bcaf4b578532d1aca2_user!userid_type:unicode'>, '_sm_au=aaaaaaaaaaaaaaaaaaaa; auth_tkt="91d7dd51be4fca295a9b80f498bcaf4b578532d1aca2_user!userid_type:unicode"; auth_tkt="91d7dd51be4fca295a9b80f498bcaf4b578532d1aca2_user!userid_type:unicode"')
paste.registry <paste.registry.Registry object at 0x7fe44e019a50>
paste.throw_errors True
pylons.action_method <bound method ShowcaseController.search of <ckanext.showcase.controller.ShowcaseController object at 0x7fe44cd4ee90>>
pylons.controller <ckanext.showcase.controller.ShowcaseController object at 0x7fe44cd4ee90>
pylons.environ_config {'session': 'beaker.session', 'cache': 'beaker.cache'}
pylons.pylons <pylons.util.PylonsContext object at 0x7fe44cd4ea50>
pylons.routes_dict {'action': u'search', 'controller': u'ckanext.showcase.controller:ShowcaseController'}
repoze.who.api <repoze.who.api.API object at 0x7fe44e019ed0>
repoze.who.identity <repoze.who identity (hidden, dict-like) at 140618523767160>
repoze.who.logger <logging.Logger object at 0x7fe456362f50>
repoze.who.plugins {'ckan.lib.authenticator:UsernamePasswordAuthenticator': <ckan.lib.authenticator.UsernamePasswordAuthenticator object at 0x7fe456362490>, 'friendlyform': <FriendlyFormPlugin 140618675532688>, 'auth_tkt': <CkanAuthTktCookiePlugin 140618675820880>}
routes.route <routes.route.Route object at 0x7fe44e10e6d0>
routes.url <routes.util.URLGenerator object at 0x7fe44cd4eb90>
webob._parsed_query_vars (GET([]), '')
webob.adhoc_attrs {'response': <Response at 0x7fe44cd4e7d0 200 OK>, 'language': 'en-us'}
wsgi process 'Multi process AND threads (?)'
wsgi.file_wrapper <built-in method file_wrapper of mod_wsgi.Adapter object at 0x7fe44cd50828>
wsgiorg.routing_args (<routes.util.URLGenerator object at 0x7fe44cd4eb90>, {'action': u'search', 'controller': u'ckanext.showcase.controller:ShowcaseController'})

Fixed.