Skip to content

Commit

Permalink
[Fixes #10263] non admin user in fresh instance cannot create resourc…
Browse files Browse the repository at this point in the history
…es_ (#10264) (#10265)

Co-authored-by: mattiagiupponi <51856725+mattiagiupponi@users.noreply.github.com>
  • Loading branch information
github-actions[bot] and mattiagiupponi committed Nov 7, 2022
1 parent 98a807a commit f67f63e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
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

0 comments on commit f67f63e

Please sign in to comment.