Skip to content
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

[Backport 4.0.x] [Fixes #10263] non admin user in fresh instance cannot create resources_ #10265

Merged
merged 1 commit into from
Nov 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions geonode/base/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ def resource_service_permissions(self, request, pk):
url_name="set-thumb-from-bbox",
methods=["post"],
permission_classes=[
IsAuthenticated, UserHasPerms
IsAuthenticated, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})
])
def set_thumbnail_from_bbox(self, request, resource_id):
import traceback
Expand Down Expand Up @@ -784,7 +784,7 @@ def resource_service_ingest(self, request, resource_type: str = None):
url_name="resource-service-create",
methods=["post"],
permission_classes=[
IsAuthenticated, UserHasPerms
IsAuthenticated, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})
])
def resource_service_create(self, request, resource_type: str = None):
"""Instructs the Async dispatcher to execute a 'CREATE' operation
Expand Down Expand Up @@ -1185,7 +1185,7 @@ def resource_service_copy(self, request, pk):
url_name="ratings",
methods=['post', 'get'],
permission_classes=[
IsAuthenticatedOrReadOnly, UserHasPerms
IsAuthenticatedOrReadOnly, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})
])
def ratings(self, request, pk):
resource = get_object_or_404(ResourceBase, pk=pk)
Expand Down Expand Up @@ -1304,7 +1304,7 @@ def set_thumbnail(self, request, pk):
detail=True,
methods=["get", "put", "delete", "post"],
permission_classes=[
IsOwnerOrAdmin, UserHasPerms
IsOwnerOrAdmin, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})
],
url_path=r"extra_metadata", # noqa
url_name="extra-metadata",
Expand Down
2 changes: 1 addition & 1 deletion geonode/geoapps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class GeoAppViewSet(DynamicModelViewSet):
"""
http_method_names = ['get', 'patch', 'post', 'put']
authentication_classes = [SessionAuthentication, BasicAuthentication, OAuth2Authentication]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})]
filter_backends = [
DynamicFilterBackend, DynamicSortingFilter, DynamicSearchFilter,
ExtentFilter, GeoAppPermissionsFilter
Expand Down
2 changes: 1 addition & 1 deletion geonode/layers/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class DatasetViewSet(DynamicModelViewSet):
"""
http_method_names = ['get', 'patch', 'put']
authentication_classes = [SessionAuthentication, BasicAuthentication, OAuth2Authentication]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})]
filter_backends = [
DynamicFilterBackend,
DynamicSortingFilter,
Expand Down
2 changes: 1 addition & 1 deletion geonode/maps/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class MapViewSet(DynamicModelViewSet):

http_method_names = ['get', 'patch', 'post', 'put']
authentication_classes = [SessionAuthentication, BasicAuthentication, OAuth2Authentication]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms]
permission_classes = [IsAuthenticatedOrReadOnly, UserHasPerms(perms_dict={"default": {"POST": ["base.add_resourcebase"]}})]
filter_backends = [
DynamicFilterBackend,
DynamicSortingFilter,
Expand Down