Skip to content

Commit

Permalink
merge: PR #776 from dev
Browse files Browse the repository at this point in the history
Weekly release 2024-06-10
  • Loading branch information
alycejenni authored Jun 10, 2024
2 parents a80c6ee + 632df40 commit e874d94
Show file tree
Hide file tree
Showing 43 changed files with 879 additions and 471 deletions.
14 changes: 7 additions & 7 deletions ckanext/nhm/lib/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,12 @@ def geojson(self) -> Optional[dict]:
if not lat_field or not lon_field:
return None

latitude = self.data.get(lat_field)
longitude = self.data.get(lon_field)

if latitude is None or longitude is None:
try:
latitude = float(self.data.get(lat_field))
longitude = float(self.data.get(lon_field))
except (ValueError, TypeError):
return None

# create a piece of GeoJSON to point at the specific record location on a map (note the
# longitude then latitude ordering required by GeoJSON)
return dict(type='Point', coordinates=[float(longitude), float(latitude)])
# create a piece of GeoJSON to point at the specific record location on a map
# (note the longitude then latitude ordering required by GeoJSON)
return dict(type="Point", coordinates=[longitude, latitude])
2 changes: 2 additions & 0 deletions ckanext/nhm/routes/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
beetle_iiif,
misc,
liv,
user,
)

blueprints = [
Expand All @@ -29,4 +30,5 @@
beetle_iiif.blueprint,
misc.blueprint,
liv.blueprint,
user.blueprint,
]
10 changes: 10 additions & 0 deletions ckanext/nhm/routes/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,13 @@ def search():
Render the help page for integrated search.
"""
return toolkit.render('help/search.html', {'title': 'Integrated Search Help'})


@blueprint.route('/dataset-permissions')
def permissions():
"""
Render the help page for dataset permissions.
"""
return toolkit.render(
'help/permissions.html', {'title': 'Dataset Permissions Help'}
)
13 changes: 12 additions & 1 deletion ckanext/nhm/routes/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Created by the Natural History Museum in London, UK

from ckan.plugins import toolkit
from flask import Blueprint, jsonify
from flask import Blueprint, jsonify, redirect

# create a flask blueprint with a prefix
blueprint = Blueprint(name='misc', import_name=__name__)
Expand All @@ -19,3 +19,14 @@ def redundancy(random_string=None):
404 and fill up the logs.
"""
return jsonify({})


@blueprint.route('/organisation')
@blueprint.route('/organisation/<path:org_path>')
def organisation_redirect(org_path=''):
"""
Redirect requests with the non-american spelling of organisation to the CKAN path.
:param org_path: additional parts of the path
"""
return redirect(f'/organization/{org_path}')
34 changes: 34 additions & 0 deletions ckanext/nhm/routes/user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# !/usr/bin/env python
# encoding: utf-8
#
# This file is part of ckanext-nhm
# Created by the Natural History Museum in London, UK

from ckan.plugins import toolkit
from flask import Blueprint

blueprint = Blueprint(name='nhm_user', import_name=__name__, url_prefix='/user')


@blueprint.route('/user/<username>/organisations', methods=['GET'])
def orgs(username):
"""
Render a list of organisations that this user is a member of.
:param username: The username
:return: str
"""
try:
toolkit.check_access('user_show', {}, {'id': username})
except toolkit.NotAuthorized:
toolkit.abort(403, toolkit._('Not authorized to see this page'))
user = toolkit.get_action('user_show')(
{'for_view': True}, {'id': username, 'include_num_followers': True}
)
orgs_available = toolkit.get_action('organization_list_for_user')(
{}, {'id': username, 'permission': 'read', 'include_dataset_count': True}
)
return toolkit.render(
'user/organisations.html',
extra_vars=dict(user_dict=user, organizations=orgs_available),
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-empty-filter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-filter-add-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-filter-add-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified ckanext/nhm/theme/public/images/help/search-filters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-freetext.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-groups-and.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-groups-not.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-groups-or.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file modified ckanext/nhm/theme/public/images/help/search-nested-groups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-presets-birdwing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-presets-hasimage-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-resources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-results-buttons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-results-gallery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-results-list.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-results-share.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-results-table.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ckanext/nhm/theme/public/images/help/search-term-editor.png
Binary file modified ckanext/nhm/theme/public/images/help/search-terms.png
93 changes: 93 additions & 0 deletions ckanext/nhm/theme/templates/help/permissions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{% extends 'help/base.html' %}

{% block breadcrumb_content %}
<li class="active">{% link_for _(title), named_route='help.permissions' %}</li>
{% endblock %}

{% block help_content %}
<div class="help-section">
<p>This page covers dataset editing permissions: who's allowed to edit which datasets, and how to change who can edit a particular dataset.</p>
</div>

<div class="help-section">
<h3>Overview</h3>
<ul>
<li>You must be a user to create or own a dataset</li>
<li>Every dataset is owned by one (and only one) user, usually its creator (unless a portal admin has changed it)</li>
<li>Owners have full edit access to their dataset</li>
<li>You can give edit permissions to additional individual users by adding <em>collaborators</em></li>
<li>You can give edit permissions to additional groups of users by changing the <em>organisation</em>.</li>
</ul>
</div>

<div class="help-section">
<h3>Collaborators</h3>
<p><em>Collaborators</em> are individual users with additional permissions on a dataset. These users will also be emailed if someone clicks the "Contact dataset curator" button on the dataset overview page.</p>
<p><b>NB: collaborators are <em>not</em> the same as contributors.</b> Contributors are names of people who contributed to the dataset in some way, and are not necessarily users. As they are used for attribution, contributors are visible in the dataset overview and usually in the citation string, whereas collaborators are only visible to dataset editors.</p>

<h4>Collaborator permissions</h4>
<p>Collaborators can have one of three different levels of access: member, editor, or admin. Each builds on the previous level (admin being the highest level with the most permissions).</p>
<ul>
<li><em>Members</em> can see the dataset if it is private, but have no edit access.</li>
<li><em>Editors</em> can also edit the dataset and its resources.</li>
<li><em>Admins</em> can also manage collaborators.</li>
</ul>

<h4>Managing collaborators</h4>
<p>Collaborators cannot be set when creating a dataset, so you will have to finish creating it first, save, and then follow these steps to find the edit page.</p>
<ol>
<li>Log in and locate a dataset that you own or have admin permissions for</li>
<li>From the dataset overview page, click the "Manage" button</li>
<li>Click the "Collaborators" tab</li>
<li>From here, you can add, remove, and manage collaborators of this dataset.</li>
</ol>
</div>

<div class="help-section">
<h3>Organisations</h3>
<p><em>Organisations</em> are groups of users that "own" datasets. While there will still be one user who is the primary owner of the dataset, every dataset also belongs to one (and only one) organisation.</p>
<p>Most datasets on the portal belong to the <a href="{{ h.url_for('organization.read', id='nhm') }}">Natural History Museum</a> organisation, which is the default, and all users are members. If you are not a part of any other organisations on the portal, you will not have the option to change the organisation your dataset belongs to.</p>
<p>An example of an organisation is the Digitisation Team, who regularly produce new datasets that multiple team members need edit access to.</p>

<h4>A note on terminology</h4>
<p>The data portal runs on a platform called <a href="https://ckan.org" class="external" target="_blank">CKAN</a>. While we have extensively modified the software for our needs, there are certain things that are deceptively difficult to change - like the name of a feature embedded throughout the code.</p>
<p>Since all data on the portal has to be associated in some way with one real-world organisation (the Natural History Museum) calling this feature <em>organisations</em> does seem a bit confusing. Unfortunately, that's what the feature is called in the core platform, and it's referenced in too many places to make it a sensible idea to change.</p>

<h4>When to use an organisation</h4>
<p>For the majority of datasets, the default organisation is fine.</p>
<p>If you have several datasets and you would like to give the same people edit access to them then your team could benefit from an organisation.</p>
<p>Only system administrators can create organisations, so if you'd like to use this feature please <a href="/contact">contact us</a>.</p>

<h4>Organisation permissions</h4>
<p>As with collaborators, users in an organisation can have one of three levels of access: member, editor, or admin. Each builds on the previous level (admin being the highest level with the most permissions).</p>
<ul>
<li><em>Members</em> can see private datasets in the organisation and add new ones, but cannot edit existing ones (unless they have other permissions, e.g. they are the dataset owner).</li>
<li><em>Editors</em> can also edit organisation datasets.</li>
<li><em>Admins</em> can also delete datasets and administrate the organisation, e.g. managing members and changing the name.</li>
</ul>

<h4>Adding a dataset to an organisation</h4>
<ol>
<li>Log in and either: click the "Manage" button on a dataset that you have edit permissions for, OR; create a new dataset</li>
<li>Change the value of the "Organisation" dropdown to the desired organisation (if you can't find this dropdown, you may not have access to any other organisations)</li>
<li>Save your changes.</li>
</ol>

<h4>Viewing your organisations</h4>
<p>Organisations that you are part of (at any role) are listed in your user profile. We also have a full list of <a href="{{ h.url_for('organization.index') }}">organisations on the portal</a>.</p>
<p>To view your available organisations:</p>
<ol>
<li>Log in</li>
<li>Click your name at the top of the page</li>
<li>Click the "organisations" tab.</li>
</ol>

<h4>Managing organisation members</h4>
<ol>
<li>Log in and locate an organisation that you have admin permissions for</li>
<li>On the organisation overview page, click the "Manage" button</li>
<li>Click the "Members" tab</li>
<li>From here, you can add, remove, and manage the members of this organisation.</li>
</ol>
</div>
{% endblock %}
Loading

0 comments on commit e874d94

Please sign in to comment.