workflows: always save current object

* Adds missing saving points of BibWorkflowObjects in the workflow
  engine when using engine execution manipulation functions such
  as `continueNextToken()`, `jumpTokenBack()`, `jumpTokenForward()`.

* Removes duplicate setting of error_msg.

Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
access: fix PEP8 and PEP257 for models

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
access: new has_(super)_admin_role methods

* Adds new properties to `User` model in order to ease access control
  calculations.  (closes #2509)

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
access: Flask-Admin interface addition

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
legacy: webuser usage cleanup

Signed-off-by: Jiri Kuncar <jiri.kuncar@cern.ch>
utils: datacite ssl protocol fix

* Fixes issue with SSL protocol version due to change by DataCite.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
debug_toolbar: error reporting fix

* Fixes an issue where an error message would be produced even if
  Flask-DebugToolbar was explicitly disabled via DEBUG_TB_ENABLED
  set to False.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
email: celery error email fix

* Fixes issue with celery not sending error emails due to config
  variable ADMIN being set different by the Flask Email extension.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
webhooks: minor documentation update

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
tests: testsuite iteration fix

* Fixes invalid attribute access to application configuration.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
search: requirejs facets fix

* Wraps facets JavasScript module in requirejs definition.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
deposit: jquery datepicker leftovers

* Removes jQueryUI css which is no longer needed after integrating
  bootstrap-datetimepicker.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
deposit: form button click fix

* Fixes refactoring issue with form button clicks not being sent to
  server.

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
deposit: field_display kwargs support

* Adds support for passing kwargs to Jinja macro field_display
  that can pass it to the field. This is useful for passing
  attributes to specific field widgets like (e.g. rows/cols
  for a textarea).

Signed-off-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
knowledge: API migration to SQLAlchemy

* Replaces run_sql queries with SQLAlchemy query.

* Refactors module in order to move logic from api to model.

* Fixes bibknowledge webinterface kb mapping update.

* NOTE If you are running Invenio 1 and Invenio 2 on top of
  the same database, please use only Invenio 2 knowledge base
  administration interface from now on, in order to ensure
  data consistency.

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
groups: user selection by autocomplete

* Implements a reusable RemoteAutocompleteField.

* Implements a Jasmine testsuite.

* Improves user selection with the autocomplete field.

* Improves group selection with the autocomplete field.
  (addresses #1788)

Signed-off-by: Leonardo Rossi <leonardo.r@cern.ch>
deposit: js uploader component

* Adds flightjs uploader component with support for pluggable
  uploader engines such as PLUpload and DropBox.

* NOTE RequireJS path to FlightJS was changed from vendors/flight/lib
  to vendors/flight. Scripts defining flight components MUST update
  their require statement from require('flight/lib/component') to
  require('flight/component').

Reviewed-by: Lars Holm Nielsen <lars.holm.nielsen@cern.ch>
Signed-off-by: Adrian Pawel Baran <adrian.pawel.baran@cern.ch>
deposit: InvalidDepositionType handling

* Handles the InvalidDepositionType exception being raised when
  trying to initialize a deposition type on older submissions which
  is disabled via the DEPOSITION_TYPES config variable.

Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
workflows: Holding Pen previous/next robustness

* Makes the previous/next object getter more robust.

* Adds unit tests for this functionality.

Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>
workflows: aborting and skipping

* Adds support in the workflow engine for aborting execution and
  skipping objects using new functions `eng.skipToken()` and
  `eng.abortProcessing()` that will not save the workflow object.
  Useful in complex workflow where for example the workflow object
  is deleted as a final step in a task before aborting/skipping.

* Removes legacy DEBUG flag from engine as logging is anyway logged
  with the debug loglevel.

Reviewed-by: Jiri Kuncar <jiri.kuncar@cern.ch>
Signed-off-by: Jan Aage Lavik <jan.age.lavik@cern.ch>