Skip to content

Commit

Permalink
Allow project export for managers
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenklar committed Dec 10, 2020
1 parent edea760 commit b08d421
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Fix a bug with the import of option sets
* Fix a bug with RDF exports
* Allow anonymous users to see the terms of use
* Allow project export for managers
* Update Italian translation

## RDMO 1.3 (Oct 6, 2020)
Expand Down
2 changes: 1 addition & 1 deletion rdmo/projects/rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def is_site_manager(user, project):
rules.add_perm('projects.view_project_object', is_project_member | is_site_manager)
rules.add_perm('projects.change_project_object', is_project_manager | is_project_owner | is_site_manager)
rules.add_perm('projects.delete_project_object', is_project_owner | is_site_manager)
rules.add_perm('projects.export_project_object', is_project_owner | is_site_manager)
rules.add_perm('projects.export_project_object', is_project_owner | is_project_manager | is_site_manager)
rules.add_perm('projects.import_project_object', is_project_owner | is_project_manager | is_site_manager)

rules.add_perm('projects.view_membership_object', is_project_member | is_site_manager)
Expand Down
10 changes: 3 additions & 7 deletions rdmo/projects/templates/projects/project_detail_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ <h2>{% trans 'Options' %}</h2>
</ul>

{% has_perm 'projects.export_project_object' request.user project as can_export_project %}
{% if can_add_membership %}

{% if settings.PROJECT_EXPORTS %}
{% if settings.PROJECT_EXPORTS and can_export_project %}
<h2>{% trans 'Export' %}</h2>

<ul class="list-unstyled">
Expand All @@ -95,8 +93,8 @@ <h2>{% trans 'Export' %}</h2>
</ul>
{% endif %}

{% if settings.PROJECT_IMPORTS %}

{% has_perm 'projects.export_project_object' request.user project as can_export_project %}
{% if settings.PROJECT_IMPORTS and can_export_project %}
<h2>{% trans 'Import values from file' %}</h2>

<ul class="list-unstyled">
Expand All @@ -105,6 +103,4 @@ <h2>{% trans 'Import values from file' %}</h2>
{% include 'core/upload_form.html' with upload_url=upload_url %}
</li>
</ul>

{% endif %}
{% endif %}
3 changes: 2 additions & 1 deletion rdmo/projects/tests/test_view_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from django.urls import reverse

from rdmo.views.models import View

from ..models import Project
Expand Down Expand Up @@ -45,7 +46,7 @@
'owner': 302, 'manager': 403, 'author': 403, 'guest': 403, 'user': 403, 'site': 302, 'anonymous': 302
},
'export': {
'owner': 200, 'manager': 403, 'author': 403, 'guest': 403, 'user': 403, 'site': 200, 'anonymous': 302
'owner': 200, 'manager': 200, 'author': 403, 'guest': 403, 'user': 403, 'site': 200, 'anonymous': 302
}
}

Expand Down

0 comments on commit b08d421

Please sign in to comment.