Giter Site home page Giter Site logo

conwetlab / ckanext-privatedatasets Goto Github PK

View Code? Open in Web Editor NEW
18.0 7.0 16.0 1.39 MB

CKAN extension that allows a user to create private datasets only visible to certain users. The extension provides also an API to specify which users can access private datasets

License: GNU Affero General Public License v3.0

Shell 0.89% Python 85.71% JavaScript 1.24% CSS 0.09% HTML 12.06%
ckan-extension dataset ckan ckanext private-datasets fiware

ckanext-privatedatasets's People

Contributors

aarranz avatar aitormagan avatar amagan avatar cazaril avatar fdelavega avatar pgalves avatar psonis avatar rbvictor avatar ssladarov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ckanext-privatedatasets's Issues

Resource delete not working

Resource delete doesn't work because the after_delete function treats pkg_dict as a dict when it is sometimes a dictionary.

PrivateDatasets now implements IResourceController so it is called for the list of resources as part of the CKAN delete action.
https://github.com/ckan/ckan/blob/139f0f14ed5fe79fbef379e38ef25a540cfa2406/ckan/logic/action/delete.py#L194

This seems to be a known issue with CKAN ckan/ckan#2949.

See stack trace below:

File '/usr/lib/ckan/default/lib/python2.7/site-packages/weberror/errormiddleware.py', line 171 in call
app_iter = self.application(environ, sr_checker)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in call
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/fanstatic/publisher.py', line 234 in call
return request.get_response(self.app)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 147 in call
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/fanstatic/injector.py', line 54 in call
response = request.get_response(self.app)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/usr/lib/ckan/default/src/ckan/ckan/config/middleware/pylons_app.py', line 262 in inner
result = application(environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/beaker/middleware.py', line 73 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/beaker/middleware.py', line 156 in call
return self.wrap_app(environ, session_start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/routes/middleware.py', line 131 in call
response = self.app(environ, start_response)
File '/usr/lib/ckan/default/src/ckan/ckan/config/middleware/common_middleware.py', line 30 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/default/src/ckan/ckan/config/middleware/common_middleware.py', line 56 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/wsgiapp.py', line 125 in call
response = self.dispatch(controller, environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/wsgiapp.py', line 324 in dispatch
return controller(environ, start_response)
File '/usr/lib/ckan/default/src/ckan/ckan/lib/base.py', line 240 in call
res = WSGIController.call(self, environ, start_response)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 221 in call
response = self._dispatch_call()
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 172 in _dispatch_call
response = self._inspect_call(func)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 107 in _inspect_call
result = self._perform_call(func, args)
File '/usr/lib/ckan/default/lib/python2.7/site-packages/pylons/controllers/core.py', line 60 in _perform_call
return func(**args)
File '/usr/lib/ckan/default/src/ckan/ckan/controllers/package.py', line 1067 in resource_delete
get_action('resource_delete')(context, {'id': resource_id})
File '/usr/lib/ckan/default/src/ckan/ckan/logic/init.py', line 466 in wrapped
result = _action(context, data_dict, **kw)
File '/usr/lib/ckan/default/src/ckan/ckan/logic/action/delete.py', line 194 in resource_delete
for plugin in plugins.PluginImplementations(plugins.IResourceController):
File '/usr/lib/ckan/default/lib/python2.7/site-packages/ckanext/privatedatasets/plugin.py', line 270 in after_delete
package_id = pkg_dict['id']
TypeError: list indices must be integers, not unicode

Questions around usage

Hi,
we are trying to implement this extension on our test installation of CKAN. We're running into a few errors, part of which might be due to us having a custom extension installed, so will do some testing with it turned off. ckanext-privatedatasets installs OK, and shows us the extra fields for setting which users can see the dataset... However after we have created a dataset, if we go to edit (manage) it, we get a server error.

One question I have to start is, what is the purpose of the Acquire URL...? What sort of information would you expect to store in that field?

Thanks
Aaron

privatedatasets error

hey, I am trying to install the extension but when I enable I get an error:

I am using ubuntu 16.04 and I tried it with a fresh 2.4.9 and 2.6.6 source install.
I didnt deploy CKAN. I immediately installed the extension using these commands.

. /usr/lib/ckan/default/bin/activate
pip install -e 'git+https://github.com/conwetlab/ckanext-privatedatasets.git#egg=ckanext-privatedatasets'
or
pip install ckanext-privatedatasets

This is the message I get when using paster serve /etc/ckan/default/development.ini

Also want to point that I have successfully installed the extension in a 2.7.4 source ckan install last month but I need to use a lower CKAN version in order to use another extension as well.

Thanks!

Traceback (most recent call last):

  File "/usr/lib/ckan/default/bin/paster", line 11, in <module>
    sys.exit(run())
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 102, in run
    invoke(command, command_name, options, args[1:])
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 141, in invoke
    exit_code = runner.run(args)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 236, in run
    result = self.command()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
    relative_to=base, global_conf=vars)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 329, in loadapp
    **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
    return loadobj(APP, uri, name=name, **kw)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
    return context.create()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
    return self.object_type.invoke(self)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
    return fix_call(context.object, context.global_conf, **context.local_conf)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 55, in fix_call
    val = callable(*args, **kw)
  File "/home/hit/ckan/lib/default/src/ckan/ckan/config/middleware/__init__.py", line 45, in make_app
    load_environment(conf, app_conf)
  File "/home/hit/ckan/lib/default/src/ckan/ckan/config/environment.py", line 97, in load_environment
    p.load_all()
  File "/home/hit/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 139, in load_all
    load(*plugins)
  File "/home/hit/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 153, in load
    service = _get_service(plugin)
  File "/home/hit/ckan/lib/default/src/ckan/ckan/plugins/core.py", line 255, in _get_service
    return plugin.load()(name=plugin_name)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2203, in load
    return self.resolve()
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/pkg_resources/__init__.py", line 2209, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/ckanext/privatedatasets/plugin.py", line 25, in <module>
    from ckan.lib.plugins import DefaultPermissionLabels
ImportError: cannot import name DefaultPermissionLabels

Support for the new version of CKAN

1.Does the ckanext-privatedatasets plugin plan to support newer versions of CKAN (2.9 or later)?

2.Does this plugin not support the latest CKAN 2.8 branch?

An error occurred when running on the master branch of CKAN,
and current 2.8 branch(2.8.6).
(It worked fine with the ckan-2.8.0 tag.)
I would appreciate any answer to this question.

Error log:
Error - <type 'exceptions.IndexError'>: list assignment index out of range
URL: http://[my server]/dataset/edit/test_dataset
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/weberror/errormiddleware.py', line 171 in call
app_iter = self.application(environ, sr_checker)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/dec.py', line 147 in call
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/fanstatic/publisher.py', line 234 in call
return request.get_response(self.app)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/dec.py', line 147 in call
resp = self.call_func(req, *args, **self.kwargs)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/dec.py', line 208 in call_func
return self.func(req, *args, **kwargs)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/fanstatic/injector.py', line 54 in call
response = request.get_response(self.app)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/request.py', line 1053 in get_response
application, catch_exc_info=False)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/webob/request.py', line 1022 in call_application
app_iter = application(self.environ, start_response)
File '/usr/lib/ckan/venv/src/ckan/ckan/config/middleware/pylons_app.py', line 264 in inner
result = application(environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/beaker/middleware.py', line 73 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/beaker/middleware.py', line 156 in call
return self.wrap_app(environ, session_start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/routes/middleware.py', line 131 in call
response = self.app(environ, start_response)
File '/usr/lib/ckan/venv/src/ckan/ckan/config/middleware/common_middleware.py', line 33 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/venv/src/ckan/ckan/config/middleware/common_middleware.py', line 59 in call
return self.app(environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 125 in call
response = self.dispatch(controller, environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/wsgiapp.py', line 324 in dispatch
return controller(environ, start_response)
File '/usr/lib/ckan/venv/src/ckan/ckan/lib/base.py', line 242 in call
res = WSGIController.call(self, environ, start_response)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 221 in call
response = self._dispatch_call()
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 172 in _dispatch_call
response = self._inspect_call(func)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 107 in _inspect_call
result = self._perform_call(func, args)
File '/usr/lib/ckan/venv/local/lib/python2.7/site-packages/pylons/controllers/core.py', line 60 in _perform_call
return func(**args)
File '/usr/lib/ckan/venv/src/ckan/ckan/controllers/package.py', line 767 in edit
return self._save_edit(id, context, package_type=package_type)
File '/usr/lib/ckan/venv/src/ckan/ckan/controllers/package.py', line 986 in _save_edit
pkg = get_action('package_update')(context, data_dict)
File '/usr/lib/ckan/venv/src/ckan/ckan/logic/init.py', line 467 in wrapped
result = _action(context, data_dict, **kw)
File '/usr/lib/ckan/venv/src/ckan/ckan/logic/action/update.py', line 293 in package_update
package_plugin, context, data_dict, schema, 'package_update')
File '/usr/lib/ckan/venv/src/ckan/ckan/lib/plugins.py', line 272 in plugin_validate
return toolkit.navl_validate(data_dict, schema, context)
File '/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py', line 298 in validate
converted_data = unflatten(converted_data)
File '/usr/lib/ckan/venv/src/ckan/ckan/lib/navl/dictization_functions.py', line 461 in unflatten
current_pos[flattend_key[-1]] = data[flattend_key]
IndexError: list assignment index out of range

Editing Permissions on User-Level only instead of Organization

Displaying the "Owner" badge, as well as the list of "Allowed Users" is possible only for the initial creator of the dataset. However, as CKAN allows to have organization-level permissions, the plugin should check permissions not on the individual level only, but on the level of dataset editing permissions.
As a result, other users that are able to manage the dataset due to the organization level permissions don't see the allowed users but an empty field and thus cannot remove users from the list.

Example:
User A and B editor in Organization O1.
Dataset D1 created by A in O1.
D1 allowed for User C by using the plugin.

D1 can be edited by B, but the allowed users list is empty.

CKAN-Version: 2.8.2
Plugin-Version: 520da26

Usage with ckanext-schemating

I have a question whether any of you tried to use ckanext-privatedatasets with ckanext-scheming & ckanext-composite & ckanext-repeating simultaneously.

Unfortunately, when I use the metadata schema created from the JSON file for ckanext-scheming, fields responsible for handling the ckanext-privatedatasets plugin are not added to the "New Dataset" form.

Is it enough to add specific values ​​to the .json file in ckanext-scheming?
And if so, which field_name ​​are responsible for Visibility, Searchable, Allowed Users and Acquire URL fields.

More than one fallback IDatasetForm has been registered

I have installed CKAN on a Ubuntu 12.04 64bit system and everything was fine. I also installed correctly these extensions:

ckan.plugins = stats image_view webpage_view recline_grid_view pdf_view spatial_metadata spatial_query datastore datapusher extrafields apihelper viewhelpers navigablemap choroplethmap barchart repo_info dashboard_preview resource_proxy geojson_preview wms_preview vegaview hierarchy_display hierarchy_form harvest ckan_harvester archiver qa

Now, I wanted to add ckanext-privatedatasets but I am having the following error:

Traceback (most recent call last):
File "/usr/lib/ckan/default/bin/paster", line 9, in
load_entry_point('PasteScript==1.7.5', 'console_scripts', 'paster')()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 104, in run
invoke(command, command_name, options, args[1:])
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 143, in invoke
exit_code = runner.run(args)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 284, in command
relative_to=base, global_conf=vars)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/script/serve.py", line 321, in loadapp
*_kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, *_kw)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 272, in loadobj
return context.create()
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 710, in create
return self.object_type.invoke(self)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 146, in invoke
return fix_call(context.object, context.global_conf, *_context.local_conf)
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/paste/deploy/util.py", line 56, in fix_call
val = callable(_args, *_kw)
File "/usr/lib/ckan/default/src/ckan/ckan/config/middleware.py", line 58, in make_app
load_environment(conf, app_conf)
File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 232, in load_environment
p.load_all(config)
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 134, in load_all
load(_plugins)
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 166, in load
plugins_update()
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 116, in plugins_update
environment.update_config()
File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 272, in update_config
routes_map = routing.make_map()
File "/usr/lib/ckan/default/src/ckan/ckan/config/routing.py", line 343, in make_map
lib_plugins.register_package_plugins(map)
File "/usr/lib/ckan/default/src/ckan/ckan/lib/plugins.py", line 81, in register_package_plugins
raise ValueError("More than one fallback "
ValueError: More than one fallback IDatasetForm has been registered

I would be grateful if someone can give me an advice to look for a solution to this.

Error After Installing CKAN Private Datasets Plugin

Hi Team,

I have install CKAN Private Datasets plugin by following link below and got this error.

https://extensions.ckan.org/extension/privatedatasets/

Version : 2.9.3
Error :

rr.log
load_environment(conf)
File "/usr/lib/ckan/default/src/ckan/ckan/config/environment.py", line 123, in load_environment
p.load_all()
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 165, in load_all
load(*plugins)
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 179, in load
service = _get_service(plugin)
File "/usr/lib/ckan/default/src/ckan/ckan/plugins/core.py", line 282, in _get_service
raise PluginNotFoundException(plugin_name)
ckan.plugins.core.PluginNotFoundException: privatedatasets

What is the parser for mentioned in the installation readme?

Looking at the current installation readme, there is the instruction

In the same config file, specify the location of your parser by adding the ckan.privatedatasets.parser setting. For example, to set the FiWareNotificationParser as notification parser, add the following line: ckan.privatedatasets.parser = ckanext.privatedatasets.parsers.fiware:FiWareNotificationParser.

What is this parser for?

how to use this extension

I have installed this extension as steps mentioned here but i am not able to find a way out to use it. My current requirement is that is approx 20k datasets which i need to mark as public or private according to the respective users. My data is coming from the context broker.

So now i have two questions:-

  1. Is this the correct solution which i am following ?
  2. If this solution is correct how should i go about it.

Any help regarding this issue will be much appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.