Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CKAN extension to allow admin/editor users to assign datasets to any CKAN group.

License

NotificationsYou must be signed in to change notification settings

salsadigitalauorg/ckanext-package-group-permissions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A CKAN extension to allow any user with admin or editor role in an organisation to assign datasets in their organisation to any group in CKAN.

Compatibility

This extension has been tested with CKAN v2.8.3 & v2.9.2.

While not tested with v2.7.0+ - the required permission was changed from 'update' to 'manage_group' in v2.7.0, so thisshould work in v2.7.0+.

Our use case

We wanted the ability for any user with admin or editor role in an organisation to be able to assign datasets in their organisation to any group in CKAN.

Previously, this was handled manually, i.e. each admin/editor user was assigned as an admin of each group in CKAN by adding them via the API. This process was very time consuming as the number of admins/editors and groups increased.

We tried implementing the suggestions outlined in this Stack Overflow question:https://stackoverflow.com/questions/37279610/ckan-package-group-permissions - however we were unable to get it working as desired.

Our solution

Our solution ended up being a little simpler for our requirements:

Override CKANmember_create function

The overridden function is largely based on thecore CKANmember_create function, with an additional check to see if the user is an admin or editor of the organisation that owns the dataset.

Template overrides

This solution also requires some CKAN templates to be overridden:

templates/package/group_list.html

Overridden to displayall groups to the userif the user haspackage_update permission for the dataset.

If the user does not havepackage_update permission - it falls back to the CKAN default of displaying only the groups that user is assigned to.

templates/group/snippets/group_item.html

Overridden to display thedelete button on a group assigned to the dataset if the user hasmember_delete permission for the group.

This also supports the default CKAN behaviour to display the delete button on any groups that user is assigned to.

Installation

  1. Clone this repository into your CKAN extensions directory, e.g./usr/lib/ckan/default/src

  2. Activate your virtualenv and run thesetup.py, e.g.

     . /usr/lib/ckan/default/bin/activate cd ckanext-package-group-permissions python setup.py develop
  3. Addpackage_group_permissions tockan.plugins in your CKAN.ini file, e.g.

     ckan.plugins = ... package_group_permissions
  4. Restart Apache/Nginx/UWSGI

About

CKAN extension to allow admin/editor users to assign datasets to any CKAN group.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors3

  •  
  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp