-
Notifications
You must be signed in to change notification settings - Fork 1.2k
[Fixes #14152] Restrict the creation of remote resources to administrators only by default #14156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,7 @@ | |
| from geonode.base.models import ResourceBase | ||
| from geonode.harvesting.models import Harvester | ||
| from geonode.security.views import _perms_info_json | ||
| from geonode.security.utils import get_visible_resources | ||
| from geonode.security.utils import get_visible_resources, check_add_remote_resource_perm | ||
| from django.core.cache import caches | ||
|
|
||
| from .models import Service | ||
|
|
@@ -59,6 +59,8 @@ def services(request): | |
|
|
||
| @login_required | ||
| def register_service(request): | ||
| check_add_remote_resource_perm(request.user) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @nrjadkry I think this check should go under the POST case
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. my fault @nrjadkry I thought it was another section of the UI. Of course we don't want to present the form to non-admins by default. |
||
|
|
||
| service_register_template = "services/service_register.html" | ||
| if request.method == "POST": | ||
| form = forms.CreateServiceForm(request.POST) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make this test more robust, it's a good practice to also verify that the document has been successfully created in the database, not just that the request resulted in a redirect.