data-govt-nz / ckanext-protected_resources Goto Github PK
View Code? Open in Web Editor NEWA plugin for CKAN that enables a system administrator to protect dataset resources from accidental deletion
License: GNU Affero General Public License v3.0
A plugin for CKAN that enables a system administrator to protect dataset resources from accidental deletion
License: GNU Affero General Public License v3.0
Currently this plugin is being tested/developed against ckan 2.7. We should be testing this works with 2.8 and the latest trunk. It would be nice to know if this plugin supports ckan versions prior to 2.7
Current message is misleading. See 9b95ab1#diff-17e1e8f86a41aeebb25d839d93e61be5R173
Better to inform that it's protected, that's why the delete action cannot be performed and that they should contact someone if there is a legit reason it needs to be removed.
Currently we are testing this plugin as part of a larger selenium test suite used in another project. It makes sense for this project to own it's own unit tests.
Here are the automated feature tests we have currently.
@protected-resource
Feature: Sysadmins can mark resources as protected to avoid acidental deletion
Background: There is a user with editor permissions in an organiation
Given an Organisation "Ministry of Silly Walks"
And a admin User "admin" "[email protected]"
And a User "sfry" "[email protected]"
And "sfry" has Admin Permission in Organisation "Ministry of Silly Walks"
And A dataset with two resources
@fixture.cleanup_datasets
Scenario: As a sysadmin I can't delete a protected dataset
Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
And I login with the user "admin"
And I am on the Dataset Page for "Abalone Data"
When I press "Manage"
And I wait for "1" seconds
Then I should see the text on the page "This dataset contains a protected resource"
@fixture.cleanup_datasets
Scenario: As a sysadmin I can delete a non-protected resource
Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
And I login with the user "admin"
And I am on the Dataset Page for "Abalone Data"
And I press "data.json"
And I wait for "1" seconds
When I press "Manage"
Then I should see
"""
Delete
"""
@fixture.cleanup_datasets
Scenario: As an admin I can't delete a protected dataset
Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
And I login with the user "sfry"
And I am on the Dataset Page for "Abalone Data"
When I press "Manage"
And I wait for "1" seconds
Then I should see the text on the page "This dataset contains a protected resource"
@fixture.cleanup_datasets
Scenario: As an admin I can't delete a protected dataset
Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
And I login with the user "sfry"
And I am on the Dataset Page for "Abalone Data"
And I press "abalone_data.csv"
And I wait for "1" seconds
When I press "Manage"
And I wait for "1" seconds
Then I should see the text on the page "This resource is protected"
@fixture.cleanup_datasets
Scenario: As a sysadmin I can lock a non-protected resource
Given I login with the user "admin"
And I am on the Dataset Page for "Abalone Data"
When I press "data.json"
And I wait for "1" seconds
Then I should see the text on the page "Lock Resource"
@fixture.cleanup_datasets
Scenario: As a sysadmin I can unlock a protected resource
Given A protected resource "abalone_data.csv" on the "Abalone data" dataset
And I login with the user "admin"
And I am on the Dataset Page for "Abalone Data"
When I press "abalone_data.csv"
And I wait for "1" seconds
Then I should see the text on the page "Unlock Resource"
Take the messages and wrap them in the relevant internationalization functions
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.