Commit Graph

136 Commits

Author SHA1 Message Date
amercader 2ee27164c3 [#13] Remove or deprecate unused code
Mostly in controllers, dictization and plugin, either related to the old
templates pre-dataset type or old authorization.
2013-03-06 16:54:33 +00:00
amercader 74633d0803 Fix error count in job stats
We want to take into account objects with errors that where created or
updated anyway (eg bbox errors), so we bascially query for the number of
objects that have object errors.

Also add the number of gather errors to this count.
2013-03-06 13:44:04 +00:00
amercader bec31a611e Fix empty job finished date 2013-03-06 13:42:35 +00:00
amercader 04710fd1c6 Revert removal of filter in job list action in 7544d5c 2013-03-06 12:19:20 +00:00
John Martin 7544d5c5ef [#7] Removed faceted navigation for uneeded toggles in job reports 2013-03-05 15:23:42 +00:00
amercader 217d58d3a4 Merge branch 'source_extra_config_validation' of github.com:okfn/ckanext-harvest into source_extra_config_validation 2013-02-28 16:03:27 +00:00
amercader f28dc97f79 Fix bug in harvest job reports 2013-02-28 15:47:56 +00:00
kindly 871576f89c Merge remote-tracking branch 'remotes/origin/source_extra_config_validation' into source_extra_config_validation 2013-02-28 13:48:58 +00:00
kindly 9cef777e7b make sure config is also on top level 2013-02-28 13:46:16 +00:00
amercader e82410724a Merge branch '7-harvest-source-templates' into source_extra_config_validation 2013-02-28 12:18:09 +00:00
amercader f7cba69fe6 Merge branch '2.0-dataset-sources' into 7-harvest-source-templates 2013-02-28 12:17:47 +00:00
amercader a86d91c3f0 [#11] Make get actions side_effect_free 2013-02-28 12:17:15 +00:00
amercader fe6952ed00 Merge branch '7-harvest-source-templates' into source_extra_config_validation 2013-02-27 15:45:33 +00:00
kindly 5b50126670 source extras field type 2013-02-25 18:07:34 +00:00
amercader efe977512b Include gather errors on job summaries and reports 2013-02-25 17:17:08 +00:00
amercader 57b3739dd4 [#7] Return most recent job on source status, not just finished 2013-02-25 15:32:39 +00:00
amercader eaa8988440 [#4] Changes in schema to accommodate organizations
Basically handle the 'owner_org' field in form_to_db and db_to_form.
Added 'owner_org', 'frequency' (has default) and 'config' to surplus
keys in check_data_dict.
Also remove schema tweaks to let package_show call the appropiate schema
function.
2013-02-11 16:34:52 +00:00
amercader 3c50a40a76 [#5] Fix auth for harvest_job_list (should forward to harvest_source_update) 2013-02-05 16:41:29 +00:00
amercader e1ce0b7267 [#5] Allow not returning error summary on job dictize 2013-02-04 18:28:45 +00:00
amercader 8576ad6784 [#5] Add job listing page 2013-02-04 18:20:58 +00:00
amercader 42bace3628 [#5] Add new finished field for harvest job
When the run command flags a job as finished, it will query the most
recent harvest object for this job and use its import_finished value as
the job finishing time.
2013-01-28 17:19:28 +00:00
amercader c8e7086567 [#5] Change default auth for showing and listing jobs
Forward auth checks to harvest_source_update instead of
harvest_source_show, as job reports should only be visible to users that
can manage sources.
2013-01-28 16:31:11 +00:00
amercader ab78bf21b9 [#5] Fix typo in delete auth function 2013-01-28 16:15:38 +00:00
amercader 676c7d34b6 [#5] Add method for returning the original URL for a document
Harvesters implementing IHarvester can define a `get_original_url`
method that should return a URL pointing to the original location of a
document in the remote server. If present, this URL will be used on the
job reports.

Examples:
* For a CKAN record: http://{ckan-instance}/api/rest/{guid}
* For a WAF record: http://{waf-root}/{file-name}
* For a CSW record: http://{csw-server}/?Request=GetElementById&Id={guid}&...
2013-01-24 18:35:43 +00:00
amercader daa9a385ff Update job keys changed on 9ba6e8f 2013-01-24 17:36:58 +00:00
amercader 30d58b2b7b [#5] Preliminary job report logic function and page (WIP) 2013-01-23 18:04:19 +00:00
amercader b2b89dfd61 Add command for reindex all harvest sources 2013-01-22 16:43:36 +00:00
amercader 9ba6e8f3b3 [#5] Add error summary to harvest_job_dictize
It will return the counts for the 20 most common errors for that
particular job. These will available when calling harvest_job_show.

Also refactor the harvest source status object to just call
harvest_job_dictize on the 'last_job' key, as it has all the
interesting fields anyway.
2013-01-22 13:13:24 +00:00
amercader 30c9eedf5f Improve harvest source status creation
Use report_status field to improve speed, remove unnecessary fields.
2013-01-17 15:43:45 +00:00
amercader 2ab10afcf9 [#4] Fix typo in auth functions 2013-01-16 12:56:58 +00:00
amercader 2bb669af21 [#4] Add owner_org field to schema and form
This should store the owner organization id.

Also added the errors box on the form.
2013-01-10 12:23:01 +00:00
amercader e49dd94b34 [#4] Remove authorization functions for the publisher profile
The different profiles will be now configured via the harvest source
datasets on CKAN core, so they are no longer needed.
2013-01-09 17:35:47 +00:00
amercader 058dcad435 [#4] Minor change on the state field to fix a bug on harvest_source_show 2013-01-09 17:31:30 +00:00
amercader a866445023 [#4] Refactor authorization functions
The authorization functions have been refactored to take into account
both the new organizaton based authorization on CKAN core and the
harvest source datasets.

Basically at the source level, authorization checks are forwarded to the
relevant package auth function (package_create, package_update, etc.)
wich will check for organizations membership, sysadmin, etc.

Also we only use functions available on the plugins toolkit whenever
possible.
2013-01-09 17:26:48 +00:00
kindly 7b6beb1470 fix wrong authorization logic 2012-12-24 22:34:37 +00:00
amercader 43950aa4ff Merge branch 'release-v2.0' into 4-new-auth-for-2.0
Conflicts:
	ckanext/harvest/logic/action/get.py
	ckanext/harvest/tests/test_queue.py
2012-12-20 16:38:57 +00:00
amercader 19cd80b264 [#4] Fixes on the auth layer against the new core auth
Thanks @locusf for the original patch
2012-12-20 16:09:26 +00:00
kindly b940baacc0 make statistics use new report_field 2012-12-18 02:39:14 +00:00
kindly 6b42d96fe0 add report_status field 2012-12-17 23:50:26 +00:00
kindly 596b9bb475 fix auth to use new sysadmin flag 2012-12-17 23:46:43 +00:00
amercader 6df525a377 Reindex the harvest source dataset after finishing jobs
This ensures that the status details shown on the harvest sources search
page is up to date (as it is loaded from the indexed data_dict)
2012-12-14 14:27:55 +00:00
amercader c1b0415cb6 Merge branch 'release-v2.0' into 2.0-dataset-sources
Conflicts:
	ckanext/harvest/model/__init__.py
2012-12-13 18:33:59 +00:00
amercader b424ba1cea Add flag to avoid returning all objects when getting a job 2012-12-13 18:20:49 +00:00
amercader 0dde483992 Set job status to Finished when actually finishing it
Until now, harvest jobs were set to Finished just after sending all
objects to the fetch stage. Now every time the run command is run, jobs
are set to Running, and all previous Running jobs are checked to see if
all harvest objects have a state of Complete or Error. Only then the job
is flagged as Finished.
2012-12-13 18:19:22 +00:00
amercader 81c3881a1a Add active field to source dict 2012-12-13 18:00:07 +00:00
amercader 8e1621731b Move harvest source status function as a logic function
The status dict is added automatically to harvest source packages.
Note that the actual queries still need to be updated as they proabably
won't scale.
2012-12-12 11:45:13 +00:00
amercader b0407bb2ac Update harvest_source_show logic function 2012-12-11 12:49:05 +00:00
amercader 9d83322591 Fix config validator and add tests 2012-11-30 17:02:06 +00:00
amercader 803b228d1c Update harvest source create and update logic functions
`harvest_source_create` and `harvest_source_update` now call
`package_create` and `package_update` respectively, making sure to
define a 'harvest_source' type. The returned dict uses the db_to_form
schema.
2012-11-30 14:11:24 +00:00
amercader 0e0aed0503 Clean up schemas
Better naming, remove old ones, ignore __extras field
2012-11-30 13:20:37 +00:00
amercader 7db09fceb0 Various fixes for the harvest source dataset type forms
Add a db to form schema to show the fields stored in extras. Validate
the source url on the Package object.
2012-11-29 16:57:20 +00:00
amercader 9d36fd6841 First stub of the new dataset type forms
Adds a 'harvest_source' dataset type that mimics the original harvest
source form.
It works against the 3022 branch on CKAN core.
2012-11-29 12:31:48 +00:00
amercader 54ff0526bb Return original document if present when requesting an object 2012-11-13 12:06:36 +00:00
kindly 6db65b5826 made manual default not null 2012-11-05 13:17:32 +00:00
amercader fdf01c09f2 Fix wrong check for harvest sources 2012-11-01 14:12:45 +00:00
kindly 2529a17304 add jobs at certain frequencies 2012-10-29 17:15:02 +00:00
amercader c1f83e0d3e Strip spaces from url when creating or updating a source 2012-08-17 12:24:41 +01:00
amercader bb5ba43ebb Allow showing harvest objects by default (on the default auth profile) 2012-08-09 13:37:28 +01:00
amercader 4c562e5f5f Do not store the object when importing 2012-08-09 11:17:41 +01:00
amercader 4d2fdeac57 Allow defining segments of harvest objects to import
Useful when importing large number of objects, as it allows
parallelization
2012-08-02 18:41:59 +01:00
amercader 7011efe5dc Allow not linking to datasets when importing records
With the -j flag, harvest objects are not linked to datasets when
importing. This is useful sometimes when importing records for the first
time.
2012-07-30 12:11:55 +01:00
amercader 4d00e665f1 [cli] Speed up run command 2012-06-29 11:32:18 +01:00
David Read ccf0cd3da2 Add copious logging to record what happens in harvesting. 2012-06-08 17:09:22 +01:00
David Read a5fac2ac86 Added logic for getting a harvest source when viewing a dataset. 2012-06-01 17:03:40 +01:00
David Read 5151f4ee23 In publisher auth mode, any member of the group can make the changes. This brings things in line with the general idea that Admins have the power to do this plus authorize other editors/admins. 2012-05-29 15:21:34 +01:00
amercader f0a09e8299 [logic] Fix small bug in dictization 2012-05-09 15:58:23 +01:00
amercader 38a9a03355 [logic] Fix variables naming 2012-03-19 17:01:20 +00:00
Ian Murray 1145e6ea72 [master][auth/publisher] Check for 'ignore_auth' in harvest_object_show
Use case: In ckanext-dgu we want to index the harvest_object.content field.  As indexing is done synchronously we need
to provide a way for that harvest_object to be accessed when the current http request is made by a non-sysadmin user.
2012-03-15 18:14:57 +00:00
Ian Murray 7f10418f44 [master][auth] get_obj_object() function was missing 2012-03-15 18:09:44 +00:00
amercader 4a7007460b [logic] Fix broken imports 2012-03-07 17:08:17 +00:00
amercader d9cfc52643 [ui,auth] Aggregate sources by publisher on the sources list 2012-03-07 11:49:12 +00:00
amercader 97b390f3c1 [auth,logic,ui] Handle publishers on the UI
Add fields for publishers in the form when using the publihser auth
profile. Some changes related to the source schema.
2012-03-06 16:01:43 +00:00
amercader aea785701f [logic,auth] Check that users actually exist 2012-03-06 10:37:31 +00:00
amercader f0e2521d9b [logic,auth] Modify checks to ensure users are admins of their publishers 2012-03-06 10:16:27 +00:00
amercader 2a2397c0ed [logic,auth] Implement publisher auth profile
The publisher profile allows general users to handle harvest sources
based on membership to a certain group (publisher), as opposed to the
default auth profile where only sysadmins can perform any harvesting
task.
To enable it, put this directive in your ini file:

    ckan.harvest.auth.profile = publisher

TODO:
 * Save publisher id / user id when creating sources
 * Show publisher in form and index page
2012-03-02 16:49:39 +00:00
amercader a35eb75440 [logic,auth] Add auth logic layer
The first version of the auth layer is based on the current policy, i.e.
you need to be sysadmin to perform any action.

TODO: the CLI is still not working.
2012-03-01 12:02:16 +00:00
amercader c798013752 [logic] Refactor the rest of the logic functions (create,update,delete) 2012-02-29 15:20:35 +00:00
amercader 651474e9f1 [logic] Refactor logic layer to follow CKAN core conventions
To make maintenance easier and better support the upcoming auth checks,
the logic layer has been refactored to mimic the structure of the one on
CKAN core: separate actions and dictize functions and logic functions
receive a context.
Only get functions are included in this commit.
2012-02-29 10:59:02 +00:00
amercader e03c2545ca [ui,logic] Expose source title in the source form 2012-02-15 11:49:59 +00:00
amercader 2990353533 [ui,logic] Expose source state (active/inactive) in the source form 2012-02-14 14:24:32 +00:00
amercader 4d7b8143b9 [lib] Renable unique constraint in url for inactive sources 2012-02-14 11:28:11 +00:00
Friedrich Lindenberg 13f2fb3b96 use hasattr for config validation 2011-06-09 11:35:58 +02:00
Adrià Mercader 7b61fb62bf Ignore missing config values 2011-06-07 15:32:46 +01:00
Adrià Mercader 6e75d362e3 Add a simple way for harvesters to store configuration options. If form_config_interface is Text on the info dictionary, the configuration field will be enabled in the form. Harvesters can also provide a validate_config method. 2011-06-07 12:07:53 +01:00
Adrià Mercader 565eaf3d0a Add a new info method to the harvester interface so implementations can provide details. Use this to build the WUI form 2011-05-13 18:39:36 +01:00
Adrià Mercader bbe459527f [forms] Major refactoring of the harvest forms. Forms no longer use the DGU form
API, and are handled similarly to the new ones on CKAN core (logic, schema,
validators...). The UI is also more consistent with the CKAN one.
2011-05-13 14:17:58 +01:00