Skip to content

Commit

Permalink
cleanup for v0.13.1 release (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Aug 25, 2023
1 parent 9629429 commit 42dac37
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 82 deletions.
14 changes: 7 additions & 7 deletions config/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,19 +104,23 @@
# Bgjobs app settings
BGJOBS_PAGINATION = 15

# Timeline app settings
TIMELINE_PAGINATION = 15

# Adminalerts app settings
ADMINALERTS_PAGINATION = 15

# Appalerts app settings
APPALERTS_STATUS_INTERVAL = 3

# Filesfolders app settings
FILESFOLDERS_MAX_UPLOAD_SIZE = 10485760
FILESFOLDERS_MAX_ARCHIVE_SIZE = 52428800
FILESFOLDERS_SERVE_AS_ATTACHMENT = False
FILESFOLDERS_LINK_BAD_REQUEST_MSG = 'Invalid request'
FILESFOLDERS_SHOW_LIST_COLUMNS = True

# Timeline app settings
TIMELINE_PAGINATION = 15


# UI test settings
PROJECTROLES_TEST_UI_CHROME_OPTIONS = [
'headless=new',
Expand All @@ -130,7 +134,3 @@
)

PROJECTROLES_APP_SETTINGS_TEST = None


# Appalerts app settings
APPALERTS_STATUS_INTERVAL = 3
33 changes: 15 additions & 18 deletions config/urls.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from django.conf import settings
from django.conf.urls import include, url
from django.urls import path
from django.conf.urls import include
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.auth import views as auth_views
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from django.urls import path
from django.views import defaults as default_views

import django_saml2_auth.views
Expand All @@ -30,26 +30,26 @@
path('icons/', include('dj_iconify.urls')),
# Projectroles URLs
path('project/', include('projectroles.urls')),
# Timeline URLs
path('timeline/', include('timeline.urls')),
# Filesfolders URLs
path('files/', include('filesfolders.urls')),
# django-db-file-storage URLs (obfuscated for users)
path('DJANGO-DB-FILE-STORAGE-CHANGE-ME/', include('db_file_storage.urls')),
# User Profile URLs
path('user/', include('userprofile.urls')),
# Admin Alerts URLs
path('alerts/adm/', include('adminalerts.urls')),
# App Alerts URLs
path('alerts/app/', include('appalerts.urls')),
# Background Jobs URLs
path('bgjobs/', include('bgjobs.urls')),
# Filesfolders URLs
path('files/', include('filesfolders.urls')),
# django-db-file-storage URLs (obfuscated for users)
path('DJANGO-DB-FILE-STORAGE-CHANGE-ME/', include('db_file_storage.urls')),
# Site Info URLs
path('siteinfo/', include('siteinfo.urls')),
# SODAR Cache app
path('cache/', include('sodarcache.urls')),
# Timeline URLs
path('timeline/', include('timeline.urls')),
# API Tokens URLs
path('tokens/', include('tokens.urls')),
# Background Jobs URLs
path('bgjobs/', include('bgjobs.urls')),
# Data Cache app
path('cache/', include('sodarcache.urls')),
# User Profile URLs
path('user/', include('userprofile.urls')),
# Example project app URLs
path('examples/project/', include('example_project_app.urls')),
# Example site app URLs
Expand Down Expand Up @@ -91,10 +91,7 @@
view=default_views.page_not_found,
kwargs={'exception': Exception('Page not Found')},
),
path(
route='500/',
view=default_views.server_error,
),
path(route='500/', view=default_views.server_error),
]

urlpatterns += staticfiles_urlpatterns()
Expand Down
Binary file modified docs/source/_static/app_projectroles/sodar_remote_projects.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 docs/source/_static/app_projectroles/sodar_remote_sites.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
59 changes: 32 additions & 27 deletions docs/source/app_projectroles_usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,13 +344,8 @@ In the current implementation, your django site must either be in **source** or
project data can be provided. A target site can define exactly one source site,
from which project data can be retrieved from.

.. note::

These are arbitrary restrictions which may be relaxed in the future, if use
cases warrant it.

To enable remote project data reading, you must first set up either a target
or a source site depending on the role of your own SODAR site.
To enable remote project data and member synchronization, you must first set up
either a target or a source site depending on the role of your own SODAR site.

.. figure:: _static/app_projectroles/sodar_remote_sites.png
:align: center
Expand All @@ -362,26 +357,29 @@ As Source Site
--------------

Navigate to the **Remote Site Access** site app and click on the
*Add Target Site* link. You will be provided with a form for specifying the
remote site. A secret string is generated automatically and you need to provide
this to the administrator of the target site in question for accessing your
site.
:guilabel:`Add Target Site` button. You will be directed to a form for
specifying the remote site. A secret string is generated automatically. You
need to provide this to the administrator of the target site in question for
accessing your site.

Here you also have the option to hide the remote project link from your users.
Users viewing the project on the source site then won't see a link to the target
site. Owners and Superusers will still see the link (greyed out). This is most
site. Owners and superusers will still see the link (greyed out). This is most
commonly used for internal test sites which only needs to be used by admins.

Once created, you can access the list of projects on your site in regards to the
created target site. For each project, you may select an access level, of which
three are currently implemented:

- **No access**: No access on the remote site (default)
- **Read roles**: This allows for the target site to read project metadata *and*
user roles in order to synchronize project access remotely.
- **Revoked access**: Previously available access which has been revoked. The
project will still remain in the target site, but only superusers, the project
owner or the project delegate(s) can access it.
No Access
No access on the remote site (default).
Read Roles
This allows for the target site to read project metadata *and* user roles in
order to synchronize project access remotely.
Revoked Access
Previously available access which has been revoked. The project will still
remain in the target site, but only superusers, the project owner or the
project delegate(s) can access it.

.. note::

Expand Down Expand Up @@ -411,14 +409,21 @@ target site will sync the data by sending a request to the source site.
As Target Site
--------------

The source site should be set up as above using the *Set Source Site* link,
using the provided secret string as the access token.
The source site should be set up as above by cllicking on the
:guilabel:`Set Source Site` button and filling out the corresponding form. Use
the secret string provided by the source site as the access token.

After creating the source site, remote project metadata and member roles can be
retrieve the :guilabel:`Synchronize` option in the site dropdown found in the
*Remote Sites* view on the target site. Additionally, if the remote source site
is synchronized with multiple target Sites, information about those other target
sites will be synchronized as well an displayed as *Peer Sites*.

After creating the source site, remote project metadata and member roles (for
which access has been granted) can be accessed using the *Synchronize* link.
Additionally if the remote Source site is synchronized with multiple Target Sites,
information about those other Target sites will be synchronized as well an displayed
as *Peer Sites*.
To set up automated project and member sync from the source site, you will need
to run a Celery worker with Celerybeat enable. Then, set the Django setting
``PROJECTROLES_TARGET_SYNC_ENABLE`` to ``True`` and optionally set the value for
``PROJECTROLES_TARGET_SYNC_INTERVAL``. For more information, see
:ref:`app_projectroles_settings`.

Alternatively, the following management command can be used:

Expand All @@ -429,8 +434,8 @@ Alternatively, the following management command can be used:
.. note::

Creating local projects under a category synchronized from a remote source
site is **not** allowed from v0.8.3 onwards. For having local projects on a
target site, you should create and use a local root category.
site is **not** allowed. For having local projects on a target site, you
should create and use a local root category.

.. note::

Expand Down
9 changes: 4 additions & 5 deletions projectroles/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,11 +312,10 @@ def get_queryset(self, *args, **kwargs):
)
elif hasattr(qs.model, 'project') or hasattr(qs.model, 'get_project'):
return qs.filter(project=self.get_project())
else:
raise AttributeError(
'Model does not have "project" member, get_project() function '
'or "get_project_filter_key()" function'
)
raise AttributeError(
'Model does not have "project" member, get_project() method or '
'get_project_filter_key() method'
)


class ProjectModifyPermissionMixin(
Expand Down
43 changes: 19 additions & 24 deletions projectroles/views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@

class SODARAPIProjectPermission(ProjectAccessMixin, BasePermission):
"""
Mixin for providing a basic project permission checking for API views
with a single permission_required attribute. Also works with Knox token
based views.
Mixin for providing basic project permission checking for API views with a
single permission_required attribute. Also works with Knox token based
views.
This must be used in the permission_classes attribute in order for token
authentication to work.
Expand Down Expand Up @@ -214,7 +214,7 @@ class SODARAPIVersioning(AcceptHeaderVersioning):
class SODARAPIRenderer(JSONRenderer):
"""
SODAR API JSON renderer with a site-specific media type retrieved from
Django settings
Django settings.
"""

media_type = SODAR_API_MEDIA_TYPE
Expand Down Expand Up @@ -264,11 +264,11 @@ class SODARAPIGenericProjectMixin(
APIProjectContextMixin, SODARAPIBaseProjectMixin
):
"""
API view mixin for generic DRF API views with serializers, SODAR
project context and permission checkin.
API view mixin for generic DRF API views with serializers, SODAR project
context and permission checkin.
Unless overriding permission_classes with their own implementation,
the user MUST supply a permission_required attribute.
Unless overriding permission_classes with their own implementation, the user
MUST supply a permission_required attribute.
Replace lookup_url_kwarg with your view's url kwarg (SODAR project
compatible model name in lowercase)
Expand Down Expand Up @@ -369,8 +369,10 @@ class ProjectListAPIView(APIView):
**Methods:** ``GET``
**Returns:** List of project details (see ``ProjectRetrieveAPIView``). For
project finder role, only lists title and UUID of projects.
**Returns:**
List of project details (see ``ProjectRetrieveAPIView``). For project finder
role, only lists title and UUID of projects.
"""

permission_classes = [IsAuthenticated]
Expand Down Expand Up @@ -443,7 +445,7 @@ class ProjectCreateAPIView(ProjectAccessMixin, CreateAPIView):
- ``title``: Project title (string)
- ``type``: Project type (string, options: ``PROJECT`` or ``CATEGORY``)
- ``parent``: Parent category UUID (string)
- ``description``: Projcet description (string, optional)
- ``description``: Project description (string, optional)
- ``readme``: Project readme (string, optional, supports markdown)
- ``public_guest_access``: Guest access for all users (boolean)
- ``owner``: User UUID of the project owner (string)
Expand Down Expand Up @@ -476,7 +478,7 @@ class ProjectUpdateAPIView(
- ``title``: Project title (string)
- ``type``: Project type (string, can not be modified)
- ``parent``: Parent category UUID (string)
- ``description``: Projcet description (string, optional)
- ``description``: Project description (string, optional)
- ``readme``: Project readme (string, optional, supports markdown)
- ``public_guest_access``: Guest access for all users (boolean)
"""
Expand Down Expand Up @@ -577,8 +579,8 @@ class RoleAssignmentOwnerTransferAPIView(
RoleAssignmentOwnerTransferMixin, CoreAPIBaseProjectMixin, APIView
):
"""
Trensfer project ownership to another user with a role in
the project. Reassign a different role to the previous owner.
Trensfer project ownership to another user with a role in the project.
Reassign a different role to the previous owner.
The new owner must already have a role assigned in the project.
Expand Down Expand Up @@ -1175,21 +1177,14 @@ def post(self, request, *args, **kwargs):

class UserListAPIView(CoreAPIBaseMixin, ListAPIView):
"""
List users in the system.
Return a list of all users on the site. Excludes system users, unless called
with superuser access.
**URL:** ``/project/api/users/list``
**Methods:** ``GET``
**Returns**:
For each user:
- ``email``: Email address of the user (string)
- ``is_superuser``: Superuser status (boolean)
- ``name``: Full name of the user (string)
- ``sodar_uuid``: User UUID (string)
- ``username``: Username of the user (string)
**Returns**: List of serializers users (see ``CurrentUserRetrieveAPIView``)
"""

lookup_field = 'project__sodar_uuid'
Expand Down
2 changes: 1 addition & 1 deletion utility/install_python_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if [ -z "$VIRTUAL_ENV" ]; then
echo >&2 -e "\n"
exit 1;
else
pip install "wheel>=0.38.4, <0.39"
pip install "wheel>=0.40.0, <0.41"
pip install -r $PROJECT_DIR/requirements/local.txt
pip install -r $PROJECT_DIR/requirements/test.txt
pip install -r $PROJECT_DIR/requirements.txt
Expand Down

0 comments on commit 42dac37

Please sign in to comment.